# ------------------------------------------------------------------------------
# Generic stuff
-AR = WLIB
-LD = WLINK
+# Environment variables for the watcom compiler
+export WATCOM = c:\\watcom
+export INCLUDE = $(WATCOM)\\h
+
+# We will use the windows compiler under linux (define as empty for windows)
+export WINEDEBUG=fixme-all
+WINE = wine
+
+# Programs
+AR = $(WINE) wlib
+CC = $(WINE) wcc386
+LD = $(WINE) wlink
+WSTRIP = $(WINE) wstrip -q
+
LNKCFG = ld.tmp
+# Program arguments
+CFLAGS = -d1 -obeilr -zp4 -5 -zq -w2 -i=..\\common
+
+# Target files
+EXE = od65.exe
+
+# Create NT programs by default
+ifndef TARGET
+TARGET = NT
+endif
+
# --------------------- OS2 ---------------------
ifeq ($(TARGET),OS2)
SYSTEM = os2v2
-CC = WCC386
-CFLAGS = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
+CFLAGS += -bt=$(TARGET)
endif
# -------------------- DOS4G --------------------
ifeq ($(TARGET),DOS32)
SYSTEM = dos4g
-CC = WCC386
-CFLAGS = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
+CFLAGS += -bt=$(TARGET)
endif
# --------------------- NT ----------------------
ifeq ($(TARGET),NT)
SYSTEM = nt
-CC = WCC386
-CFLAGS = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
+CFLAGS += -bt=$(TARGET)
endif
-# Add the include dir
-CFLAGS += -i=..\common
-
# ------------------------------------------------------------------------------
# Implicit rules
%.obj: %.c
- $(CC) $(CFLAGS) $^
+ $(CC) $(CFLAGS) -fo=$@ $^
# ------------------------------------------------------------------------------
-# All library OBJ files
+# All OBJ files
OBJS = dump.obj \
error.obj \
global.obj \
main.obj
-LIBS = ..\common\common.lib
+LIBS = ../common/common.lib
# ------------------------------------------------------------------------------
# Main targets
-all: od65
-
-.PHONY: od65
-
-od65: od65.exe
+all: $(EXE)
# ------------------------------------------------------------------------------
# Other targets
-od65.exe: $(OBJS) $(LIBS)
- @echo DEBUG ALL > $(LNKCFG)
- @echo OPTION QUIET >> $(LNKCFG)
- @echo NAME $@ >> $(LNKCFG)
- @for %%i in ($(OBJS)) do echo FILE %%i >> $(LNKCFG)
- @for %%i in ($(LIBS)) do echo LIBRARY %%i >> $(LNKCFG)
- $(LD) system $(SYSTEM) @$(LNKCFG)
+$(EXE): $(OBJS) $(LIBS)
+ @echo "DEBUG ALL" > $(LNKCFG)
+ @echo "OPTION QUIET" >> $(LNKCFG)
+ @echo "OPTION MAP" >> $(LNKCFG)
+ @echo "OPTION STACK=65536" >> $(LNKCFG)
+ @echo "NAME $@" >> $(LNKCFG)
+ @for i in $(OBJS); do echo "FILE $${i}"; done >> $(LNKCFG)
+ @for i in $(LIBS); do echo "LIBRARY $${i}"; done >> $(LNKCFG)
+ @$(LD) system $(SYSTEM) @$(LNKCFG)
@rm $(LNKCFG)
clean:
- @if exist *.obj del *.obj
- @if exist od65.exe del od65.exe
+ @rm -f *~ core
+
+zap: clean
+ @rm -f $(OBJS) $(EXE) $(EXE:.exe=.map)
strip:
- @-wstrip od65.exe
+ @-$(WSTRIP) $(EXE)