From 9964558613deb9423491ad4e52e54dcdeabe57b1 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 21 Jan 2008 11:50:31 -0800 Subject: [PATCH] Fix the options when compiling under OpenWatcom OpenWatcom needs different strings for compile and link target, so using -bcl which uses the same string for both is just plain wrong. This fixes that bit, but running nasm on test/floatx.asm (at least as a DOS or a Win32 binary) crashes with a NULL pointer reference inside the C library free() function. --- Mkfiles/openwcom.mak | 10 +++++----- Mkfiles/owlinux.mak | 26 +++++++++++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Mkfiles/openwcom.mak b/Mkfiles/openwcom.mak index 124f7be..9905ffd 100644 --- a/Mkfiles/openwcom.mak +++ b/Mkfiles/openwcom.mak @@ -14,8 +14,8 @@ bindir = $(prefix)\bin mandir = $(prefix)\man CC = wcl386 -CFLAGS = -3 -bcl=$(TARGET) -ox -wx -ze -fpi -BUILD_CFLAGS = $(CFLAGS) # -I$(srcdir)/inttypes +CFLAGS = -3 -ox -wx -ze -fpi +BUILD_CFLAGS = $(CFLAGS) $(TARGET_FLAGS) # -I$(srcdir)/inttypes INTERNAL_CFLAGS = -I$(srcdir) -I. -DHAVE_SNPRINTF -DHAVE_VSNPRINTF ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS) LD = $(CC) @@ -59,13 +59,13 @@ what: .SYMBOLIC @echo Please build "dos", "win32" or "os2" dos: .SYMBOLIC - $(MAKE) /f $(__MAKEFILES__) all TARGET=DOS4G + $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=DOS -l=DOS4G" win32: .SYMBOLIC - $(MAKE) /f $(__MAKEFILES__) all TARGET=NT + $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=NT -l=NT" os2: .SYMBOLIC - $(MAKE) /f $(__MAKEFILES__) all TARGET=OS2V2 + $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=OS2 -l=OS2V2" all: nasm$(X) ndisasm$(X) .SYMBOLIC rem cd rdoff && $(MAKE) all diff --git a/Mkfiles/owlinux.mak b/Mkfiles/owlinux.mak index 2c93cb9..f8f7d6e 100644 --- a/Mkfiles/owlinux.mak +++ b/Mkfiles/owlinux.mak @@ -3,6 +3,22 @@ # Makefile for cross-compiling NASM from Linux # to DOS, Win32 or OS/2 using OpenWatcom. # +# Please see http://bugzilla.openwatcom.org/show_bug.cgi?id=751 +# for some caveats in using OpenWatcom as a cross-compiler +# from Linux, in particular: +# +# > Second and more importantly, the makefile needs to ensure that the +# > proper headers are included. This is normally not a problem when +# > building on DOS, Windows, or OS/2, as they share the same C +# > library headers. But when cross-compiling from (or to) Linux, it +# > is crucial. +# > +# > This may be accomplished by setting the INCLUDE env var in the +# > makefile, or setting OS2_INCLUDE, DOS_INCLUDE, NT_INCLUDE env vars +# > *and* making sure that the proper -bt switch is used, or passing a +# > switch like -I"$(%WATCOM)/h". The last variant is probably the +# > easiest to implement and least likely to break. +# top_srcdir = . srcdir = . @@ -12,8 +28,8 @@ bindir = $(prefix)/bin mandir = $(prefix)/man CC = wcl386 -CFLAGS = -3 -bcl=$(TARGET) -ox -wx -ze -fpi -BUILD_CFLAGS = $(CFLAGS) # -I$(srcdir)/inttypes +CFLAGS = -3 -ox -wx -ze -fpi +BUILD_CFLAGS = $(CFLAGS) $(TARGET_FLAGS) # -I$(srcdir)/inttypes INTERNAL_CFLAGS = -I$(srcdir) -I. \ -DHAVE_SNPRINTF -DHAVE_VSNPRINTF ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS) @@ -54,13 +70,13 @@ what: @echo 'Please build "dos", "win32" or "os2"' dos: - $(MAKE) -f $(MAKEFILE_LIST) all TARGET=DOS4G + $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=DOS -l=DOS4G' win32: - $(MAKE) -f $(MAKEFILE_LIST) all TARGET=NT + $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=NT -l=NT' os2: - $(MAKE) -f $(MAKEFILE_LIST) all TARGET=OS2V2 + $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=OS2 -l=OS2V2' all: nasm$(X) ndisasm$(X) -- 2.7.4