.SUFFIXES: .o .s .c
+#--------------------------------------------------------------------------
+# Rules
+
%.o: %.c
@$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s
@$(AS) -g -o $@ $(AFLAGS) $<
-C_OBJS =
+%.emd: %.o ../runtime/zeropage.o
+ @$(LD) -t module -o $@ $^
+
+%.joy: %.o ../runtime/zeropage.o
+ @$(LD) -t module -o $@ $^
+
+%.tgi: %.o ../runtime/zeropage.o
+ @$(LD) -t module -o $@ $^
-S_OBJS= _scrsize.o \
+#--------------------------------------------------------------------------
+# Object files
+
+OBJS= _scrsize.o \
break.o \
cclear.o \
cgetc.o \
crt0.o \
ctype.o \
cvline.o \
+ get_ostype.o \
+ getenv.o \
+ joy_stddrv.o \
kbhit.o \
+ mainargs.o \
randomize.o \
read.o \
revers.o \
systime.o \
+ sysuname.o \
where.o \
write.o
-all: $(C_OBJS) $(S_OBJS)
+#--------------------------------------------------------------------------
+# Drivers
+
+EMDS =
+
+JOYS = apple2-stdjoy.joy
+
+TGIS =
+
+#--------------------------------------------------------------------------
+# Targets
+
+.PHONY: all clean zap
+
+all: $(OBJS) $(EMDS) $(JOYS) $(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) $(TGIS:.tgi=.o)
+zap: clean
+ @$(RM) $(EMDS) $(JOYS) $(TGIS)