]> git.sur5r.net Git - cc65/blobdiff - src/ld65/make/watcom.mak
Added the NES target
[cc65] / src / ld65 / make / watcom.mak
index 06b3d41cce326a84892e3834740f9b58ecf0a3ed..b14fd45a2a31af7f8e78ff42fe072d7eef6e6944 100644 (file)
@@ -1,63 +1,43 @@
 #
-# ld65 Makefile for the Watcom compiler
+# ld65 Makefile for the Watcom compiler (using GNU make)
 #
 
 # ------------------------------------------------------------------------------
 # Generic stuff
 
-.AUTODEPEND
-.SUFFIXES      .ASM .C .CC .CPP
-.SWAP
-
 AR     = WLIB
 LD     = WLINK
-
-!if !$d(TARGET)
-!if $d(__OS2__)
-TARGET = OS2
-!else
-TARGET = NT
-!endif
-!endif
-
-# target specific macros.
-!if $(TARGET)==OS2
+LNKCFG  = ld.tmp
 
 # --------------------- OS2 ---------------------
-SYSTEM = os2v2
-CC = WCC386
-CCCFG  = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
-
-!elif $(TARGET)==DOS32
+ifeq ($(TARGET),OS2)
+SYSTEM  = os2v2
+CC      = WCC386
+CFLAGS  = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
+endif
 
 # -------------------- DOS4G --------------------
-SYSTEM = dos4g
-CC = WCC386
-CCCFG  = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
-
-!elif $(TARGET)==DOS
-
-# --------------------- DOS ---------------------
-SYSTEM = dos
-CC = WCC
-CCCFG  = -bt=$(TARGET) -d1 -onatx -zp2 -2 -ml -zq -w2
-
-!elif $(TARGET)==NT
+ifeq ($(TARGET),DOS32)
+SYSTEM  = dos4g
+CC      = WCC386
+CFLAGS  = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
+endif
 
 # --------------------- NT ----------------------
-SYSTEM = nt
-CC = WCC386
-CCCFG  = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
+ifeq ($(TARGET),NT)
+SYSTEM  = nt
+CC      = WCC386
+CFLAGS  = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
+endif
 
-!else
-!error
-!endif
+# Add the include dir
+CFLAGS  += -i=..\common
 
 # ------------------------------------------------------------------------------
 # Implicit rules
 
-.c.obj:
-  $(CC) $(CCCFG) $<
+%.obj:  %.c
+       $(CC) $(CFLAGS) $^
 
 
 # ------------------------------------------------------------------------------
@@ -65,24 +45,28 @@ CCCFG  = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
 
 OBJS = bin.obj         \
        binfmt.obj      \
+       condes.obj      \
        config.obj      \
+       dbginfo.obj     \
        dbgsyms.obj     \
        error.obj       \
        exports.obj     \
        expr.obj        \
        extsyms.obj     \
+       fileinfo.obj    \
        fileio.obj      \
+       fragment.obj    \
        global.obj      \
        library.obj     \
+       lineinfo.obj    \
        main.obj        \
        mapfile.obj     \
-       mem.obj         \
        o65.obj         \
        objdata.obj     \
        objfile.obj     \
        scanner.obj     \
        segments.obj    \
-       target.obj
+       tgtcfg.obj
 
 LIBS = ..\common\common.lib
 
@@ -90,9 +74,9 @@ LIBS = ..\common\common.lib
 # ------------------------------------------------------------------------------
 # Main targets
 
-all:           ld65
+all:           ld65
 
-ld65:          ld65.exe
+ld65:          ld65.exe
 
 
 # ------------------------------------------------------------------------------
@@ -100,32 +84,14 @@ ld65:              ld65.exe
 
 
 ld65.exe:      $(OBJS) $(LIBS)
-       $(LD) system $(SYSTEM) @&&|
-DEBUG ALL
-OPTION QUIET
-NAME $<
-FILE bin.obj
-FILE binfmt.obj
-FILE config.obj
-FILE dbgsyms.obj
-FILE error.obj
-FILE exports.obj
-FILE expr.obj
-FILE extsyms.obj
-FILE fileio.obj
-FILE global.obj
-FILE library.obj
-FILE main.obj
-FILE mapfile.obj
-FILE mem.obj
-FILE o65.obj
-FILE objdata.obj
-FILE objfile.obj
-FILE scanner.obj
-FILE segments.obj
-FILE target.obj
-LIBRARY ..\common\common.lib
-|
+       @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)
+       @rm $(LNKCFG)
+
 
 clean:
        @if exist *.obj del *.obj