]> git.sur5r.net Git - cc65/blobdiff - src/da65/make/gcc.mak
Makefile cleanup. Among other things, allow use of the --as-needed linker flag
[cc65] / src / da65 / make / gcc.mak
index 49d4991f434c1a1b44f2596479c60abf1c873225..35e2805c7723a6048662513a9dab1960c7c978e0 100644 (file)
@@ -2,21 +2,29 @@
 # gcc Makefile for da65
 #
 
+# ------------------------------------------------------------------------------
+
+# The executable to build
+EXE    = da65
+
 # Library dir
 COMMON = ../common
 
-CFLAGS = -g -O2 -Wall -W -I$(COMMON)
+CFLAGS = -g -O2 -Wall -W -std=c89 -I$(COMMON)
 CC=gcc
 EBIND=emxbind
 LDFLAGS=
 
-OBJS =         attrtab.o       \
+OBJS =         asminc.o        \
+        attrtab.o      \
        code.o          \
+        comments.o      \
        data.o          \
        error.o         \
        global.o        \
        handler.o       \
        infofile.o      \
+        labels.o        \
        main.o          \
         opc6502.o       \
         opc65816.o      \
@@ -24,34 +32,34 @@ OBJS =      attrtab.o       \
         opc65sc02.o     \
        opctable.o      \
        output.o        \
-       scanner.o
+       scanner.o       \
+        segment.o
 
 LIBS = $(COMMON)/common.a
 
 
-EXECS = da65
+# ------------------------------------------------------------------------------
+# Makefile targets
 
+# Main target - must be first
 .PHONY: all
 ifeq (.depend,$(wildcard .depend))
-all : $(EXECS)
+all:   $(EXE)
 include .depend
 else
 all:   depend
        @$(MAKE) -f make/gcc.mak all
 endif
 
-
-
-da65:   $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
-       @if [ $(OS2_SHELL) ] ;  then $(EBIND) $@ ; fi
+$(EXE):        $(OBJS) $(LIBS)
+       $(CC) $^ $(LDFLAGS) -o $@
+       @if [ $(OS2_SHELL) ] ;  then $(EBIND) $(EXE) ; fi
 
 clean:
-       $(RM) *~ core *.map
+       $(RM) *~ core.* *.map
 
 zap:   clean
-       $(RM) *.o $(EXECS) .depend
-
+       $(RM) *.o $(EXE) .depend
 
 # ------------------------------------------------------------------------------
 # Make the dependencies
@@ -59,6 +67,6 @@ zap:  clean
 .PHONY: depend dep
 depend dep:    $(OBJS:.o=.c)
        @echo "Creating dependency information"
-       $(CC) -I$(COMMON) -MM $^ > .depend
+       $(CC) $(CFLAGS) -MM $^ > .depend