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 ar65 # gcc Makefile for ar65
# #
# ------------------------------------------------------------------------------
# The executable to build
EXE = ar65
# Library dir # Library dir
COMMON = ../common COMMON = ../common
@@ -27,28 +32,28 @@ OBJS = add.o \
LIBS = $(COMMON)/common.a LIBS = $(COMMON)/common.a
EXECS = ar65 # ------------------------------------------------------------------------------
# Makefile targets
# Main target - must be first
.PHONY: all .PHONY: all
ifeq (.depend,$(wildcard .depend)) ifeq (.depend,$(wildcard .depend))
all : $(EXECS) all: $(EXE)
include .depend include .depend
else else
all: depend all: depend
@$(MAKE) -f make/gcc.mak all @$(MAKE) -f make/gcc.mak all
endif endif
$(EXE): $(OBJS) $(LIBS)
$(CC) $^ $(LDFLAGS) -o $@
ar65: $(OBJS) $(LIBS) @if [ $(OS2_SHELL) ] ; then $(EBIND) $(EXE) ; fi
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
@if [ $(OS2_SHELL) ] ; then $(EBIND) $@ ; fi
clean: clean:
$(RM) *~ core $(RM) *~ core.* *.map
zap: clean zap: clean
$(RM) *.o $(EXECS) .depend $(RM) *.o $(EXE) .depend
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Make the dependencies # Make the dependencies

View File

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

View File

@@ -110,11 +110,11 @@ all: depend
endif endif
$(EXE): $(OBJS) $(LIBS) $(EXE): $(OBJS) $(LIBS)
$(CC) $(LDFLAGS) -o $(EXE) $(CFLAGS) $(OBJS) $(LIBS) $(CC) $^ $(LDFLAGS) -o $@
@if [ $(OS2_SHELL) ] ; then $(EBIND) $(EXE) ; fi @if [ $(OS2_SHELL) ] ; then $(EBIND) $(EXE) ; fi
clean: clean:
$(RM) *~ core *.map $(RM) *~ core.* *.map
zap: clean zap: clean
$(RM) *.o $(EXE) .depend $(RM) *.o $(EXE) .depend

View File

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

View File

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

View File

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

View File

@@ -2,6 +2,11 @@
# gcc Makefile for grc # gcc Makefile for grc
# #
# ------------------------------------------------------------------------------
# The executable to build
EXE = grc
COMMON = ../common COMMON = ../common
CFLAGS = -g -O2 -Wall -W -std=c89 -I$(COMMON) CFLAGS = -g -O2 -Wall -W -std=c89 -I$(COMMON)
@@ -11,30 +16,30 @@ EBIND = emxbind
OBJS = grc.o OBJS = grc.o
EXECS = grc
LIBS = $(COMMON)/common.a LIBS = $(COMMON)/common.a
# ------------------------------------------------------------------------------
# Makefile targets
# Main target - must be first
.PHONY: all .PHONY: all
ifeq (.depend,$(wildcard .depend)) ifeq (.depend,$(wildcard .depend))
all : $(EXECS) all: $(EXE)
include .depend include .depend
else else
all: depend all: depend
@$(MAKE) -f make/gcc.mak all @$(MAKE) -f make/gcc.mak all
endif endif
$(EXE): $(OBJS) $(LIBS)
$(CC) $^ $(LDFLAGS) -o $@
grc: $(OBJS) $(LIBS) @if [ $(OS2_SHELL) ] ; then $(EBIND) $(EXE) ; fi
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
@if [ $(OS2_SHELL) ] ; then $(EBIND) $@ ; fi
clean: clean:
$(RM) *~ core *.lst $(RM) *~ core.* *.map
zap: clean zap: clean
$(RM) *.o $(EXECS) .depend $(RM) *.o $(EXE) .depend
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Make the dependencies # Make the dependencies

View File

@@ -2,6 +2,11 @@
# gcc Makefile for ld65 # gcc Makefile for ld65
# #
# ------------------------------------------------------------------------------
# The executable to build
EXE = ld65
# Library dir # Library dir
COMMON = ../common COMMON = ../common
@@ -75,37 +80,31 @@ INCS = apple2.inc \
supervision.inc \ supervision.inc \
vic20.inc vic20.inc
# -----------------------------------------------------------------------------
#
LIBS = $(COMMON)/common.a LIBS = $(COMMON)/common.a
EXECS = ld65 # ------------------------------------------------------------------------------
# Makefile targets
# Main target - must be first
.PHONY: all .PHONY: all
ifeq (.depend,$(wildcard .depend)) ifeq (.depend,$(wildcard .depend))
all : $(EXECS) all: $(EXE)
include .depend include .depend
else else
all: depend all: depend
@$(MAKE) -f make/gcc.mak all @$(MAKE) -f make/gcc.mak all
endif endif
$(EXE): $(INCS) $(OBJS) $(LIBS)
$(CC) $(OBJS) $(LIBS) $(LDFLAGS) -o $@
ld65: $(INCS) $(OBJS) $(LIBS) @if [ $(OS2_SHELL) ] ; then $(EBIND) $(EXE) ; fi
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
@if [ $(OS2_SHELL) ] ; then $(EBIND) $@ ; fi
inc: $(INCS)
clean: clean:
$(RM) *~ core *.map $(RM) *~ core.* *.map
zap: clean zap: clean
$(RM) *.o $(INCS) $(EXECS) .depend $(RM) *.o $(INCS) $(EXE) .depend
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Make the dependencies # Make the dependencies

View File

@@ -3,6 +3,11 @@
# #
# ------------------------------------------------------------------------------
# The executable to build
EXE = od65
# Library dir # Library dir
COMMON = ../common COMMON = ../common
@@ -19,9 +24,10 @@ OBJS = dump.o \
LIBS = $(COMMON)/common.a LIBS = $(COMMON)/common.a
EXE = od65 # ------------------------------------------------------------------------------
# Makefile targets
# Main target - must be first
.PHONY: all .PHONY: all
ifeq (.depend,$(wildcard .depend)) ifeq (.depend,$(wildcard .depend))
all: $(EXE) all: $(EXE)
@@ -31,13 +37,12 @@ all: depend
@$(MAKE) -f make/gcc.mak all @$(MAKE) -f make/gcc.mak all
endif endif
$(EXE): $(OBJS) $(LIBS)
$(EXE): $(OBJS) $(CC) $^ $(LDFLAGS) -o $@
$(CC) $(LDFLAGS) -o $(EXE) $(CFLAGS) $(OBJS) $(LIBS)
@if [ $(OS2_SHELL) ] ; then $(EBIND) $(EXE) ; fi @if [ $(OS2_SHELL) ] ; then $(EBIND) $(EXE) ; fi
clean: clean:
$(RM) *~ core *.map $(RM) *~ core.* *.map
zap: clean zap: clean
$(RM) *.o $(EXE) .depend $(RM) *.o $(EXE) .depend

View File

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