]> git.sur5r.net Git - cc65/blob - src/ld65/make/gcc.mak
Replaced builtin linker configs with ordinary .cfg files.
[cc65] / src / ld65 / make / gcc.mak
1 #
2 # gcc Makefile for ld65
3 #
4
5 # ------------------------------------------------------------------------------
6
7 # The executable to build
8 EXE     = ld65
9
10 # Library dir
11 COMMON  = ../common
12
13 # Several search paths. You may redefine these on the command line
14 LD65_LIB = \"/usr/lib/cc65/lib/\"
15 LD65_OBJ = \"/usr/lib/cc65/lib/\"
16 LD65_CFG = \"/usr/lib/cc65/cfg/\"
17
18 #
19 CC      = gcc
20 CFLAGS  = -g -O2 -Wall -W -std=c89
21 override CFLAGS += -I$(COMMON)
22 override CFLAGS += -DLD65_LIB=$(LD65_LIB) -DLD65_OBJ=$(LD65_OBJ) -DLD65_CFG=$(LD65_CFG)
23 EBIND   = emxbind
24 LDFLAGS =
25
26 # -----------------------------------------------------------------------------
27 # List of all object files
28
29 OBJS =  asserts.o       \
30         bin.o           \
31         binfmt.o        \
32         cfgexpr.o       \
33         condes.o        \
34         config.o        \
35         dbgfile.o       \
36         dbgsyms.o       \
37         error.o         \
38         exports.o       \
39         expr.o          \
40         extsyms.o       \
41         fileinfo.o      \
42         fileio.o        \
43         filepath.o      \
44         fragment.o      \
45         global.o        \
46         library.o       \
47         lineinfo.o      \
48         main.o          \
49         mapfile.o       \
50         memarea.o       \
51         o65.o           \
52         objdata.o       \
53         objfile.o       \
54         scanner.o       \
55         scopes.o        \
56         segments.o      \
57         span.o          \
58         spool.o         \
59         tgtcfg.o        \
60         tpool.o
61
62 # -----------------------------------------------------------------------------
63 # List of all config includes
64
65 LIBS = $(COMMON)/common.a
66
67
68 # ------------------------------------------------------------------------------
69 # Makefile targets
70
71 # Main target - must be first
72 .PHONY: all
73 ifeq (.depend,$(wildcard .depend))
74 all:    $(EXE)
75 include .depend
76 else
77 all:    depend
78         @$(MAKE) -f make/gcc.mak all
79 endif
80
81 $(EXE): $(OBJS) $(LIBS)
82         $(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
83         @if [ $(OS2_SHELL) ] ;  then $(EBIND) $(EXE) ; fi
84
85 clean:
86         $(RM) *~ core.* *.map
87
88 zap:    clean
89         $(RM) *.o $(INCS) $(EXE) .depend
90
91 # ------------------------------------------------------------------------------
92 # Make the dependencies
93
94 .PHONY: depend dep
95 depend dep:     $(OBJS:.o=.c)
96         @echo "Creating dependency information"
97         $(CC) $(CFLAGS) -MM $(OBJS:.o=.c) > .depend