]> git.sur5r.net Git - cc65/blobdiff - libsrc/nes/Makefile
Moved additional zeropage variables into an extra module.
[cc65] / libsrc / nes / Makefile
index 5bc6a5b0ddcf3c3fb960a276086ad583e61d9767..78dff9968c595a8371ab0562b0d55e6332a2d493 100644 (file)
@@ -4,6 +4,18 @@
 
 .SUFFIXES: .o .s .c
 
+#--------------------------------------------------------------------------
+# Programs and flags
+
+SYS    = nes
+
+AS     = ../../src/ca65/ca65
+CC     = ../../src/cc65/cc65
+LD     = ../../src/ld65/ld65
+
+AFLAGS = -t $(SYS) -I../../asminc
+CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
+
 #--------------------------------------------------------------------------
 # Rules
 
 %.o:   %.s
        @$(AS) -g -o $@ $(AFLAGS) $<
 
+%.emd: %.o ../runtime/zeropage.o
+       @$(LD) -t module -o $@ $^
+
+%.joy: %.o ../runtime/zeropage.o
+       @$(LD) -t module -o $@ $^
+
+%.mou: %.o ../runtime/zeropage.o
+       @$(LD) -t module -o $@ $^
+
+%.ser: %.o ../runtime/zeropage.o
+       @$(LD) -t module -o $@ $^
+
+%.tgi: %.o ../runtime/zeropage.o
+       @$(LD) -t module -o $@ $^
+
 #--------------------------------------------------------------------------
 # Object files
 
-C_OBJS =
+OBJS =  _scrsize.o      \
+        cclear.o        \
+        chline.o        \
+        clock.o         \
+        clrscr.o        \
+        color.o         \
+        cputc.o         \
+        crt0.o          \
+        ctype.o         \
+        cvline.o        \
+        getenv.o        \
+        gotox.o         \
+        gotoxy.o        \
+        gotoy.o         \
+        mainargs.o      \
+        ppu.o           \
+        ppubuf.o        \
+        randomize.o     \
+        revers.o        \
+        setcursor.o     \
+        sysuname.o      \
+        waitvblank.o    \
+        wherex.o        \
+        wherey.o
+
+#--------------------------------------------------------------------------
+# Drivers
+
+EMDS =
 
-S_OBJS  =       _scrsize.o      \
-                clock.o         \
-                color.o         \
-                cputc.o         \
-                crt0.o          \
-                ppu.o           \
-                ppubuf.o        \
-                setcursor.o     \
-                waitvblank.o
+JOYS = nes-stdjoy.joy
+
+MOUS =
+
+SERS =
+
+TGIS =
 
 #--------------------------------------------------------------------------
 # Targets
 
 .PHONY:        all clean zap
 
-all:           $(C_OBJS) $(S_OBJS)
+all:   $(OBJS) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS)
+
+../runtime/zeropage.o:
+       $(MAKE) -C $(dir $@) $(notdir $@)
 
 clean:
-       @rm -f $(C_OBJS:.c=.s) $(C_OBJS) $(S_OBJS)
+       @$(RM) $(OBJS) $(EMDS:.emd=.o) $(JOYS:.joy=.o) $(MOUS:.mou=.o) $(SERS:.ser=.o) $(TGIS:.tgi=.o)
 
 zap:   clean
+       @$(RM) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS)
 
+