Makefile cleanup. Among other things, allow use of the --as-needed linker flag

by rearranging arguments for the linker.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3922 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2009-02-08 17:19:45 +00:00
parent 4c88db2d4b
commit 823d0b7636
10 changed files with 133 additions and 98 deletions

View File

@@ -2,6 +2,11 @@
# gcc Makefile for sim65
#
# ------------------------------------------------------------------------------
# The executable to build
EXE = sim65
# Library dir
COMMON = ../common
@@ -28,34 +33,32 @@ OBJS = addrspace.o \
LIBS = $(COMMON)/common.a
EXECS = sim65
# ------------------------------------------------------------------------------
# Makefile targets
# Main target - must be first
.PHONY: all
ifeq (.depend,$(wildcard .depend))
all: $(EXECS) chips
all: $(EXE) chips
include .depend
else
all: depend
@$(MAKE) -f make/gcc.mak all
endif
sim65: $(OBJS) $(LIBS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) -ldl
@if [ $(OS2_SHELL) ] ; then $(EBIND) $@ ; fi
$(EXE): $(OBJS) $(LIBS)
$(CC) $^ $(LDFLAGS) -o $@
@if [ $(OS2_SHELL) ] ; then $(EBIND) $(EXE) ; fi
.PHONY: chips
chips:
@$(MAKE) -C chips -f make/gcc.mak
clean:
@$(MAKE) -C chips -f make/gcc.mak clean
$(RM) *~ core *.lst
$(RM) *~ core.* *.map
zap: clean
@$(MAKE) -C chips -f make/gcc.mak zap
$(RM) *.o $(EXECS) .depend
zap: clean
$(RM) *.o $(EXE) .depend
# ------------------------------------------------------------------------------
# Make the dependencies