]> git.sur5r.net Git - cc65/blobdiff - src/ar65/make/gcc.mak
Makefile cleanup. Among other things, allow use of the --as-needed linker flag
[cc65] / src / ar65 / make / gcc.mak
index 48238700ff004cd092435de67673913bd4fe2a5e..665aa8f2c252ff51508093d5f2802fb78b247f7f 100644 (file)
@@ -2,6 +2,11 @@
 # gcc Makefile for ar65
 #
 
+# ------------------------------------------------------------------------------
+
+# The executable to build
+EXE    = ar65
+
 # Library dir
 COMMON = ../common
 
@@ -27,28 +32,28 @@ OBJS =      add.o           \
 LIBS = $(COMMON)/common.a
 
 
-EXECS = ar65
+# ------------------------------------------------------------------------------
+# 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
 
-
-
-ar65:   $(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
+       $(RM) *~ core.* *.map
 
 zap:   clean
-       $(RM) *.o $(EXECS) .depend
+       $(RM) *.o $(EXE) .depend
 
 # ------------------------------------------------------------------------------
 # Make the dependencies