]> git.sur5r.net Git - cc65/blob - src/ld65/make/gcc.mak
Separate processing the linker config file into two phases: The config file is
[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 # Perl script for config file conversion
27 CVT=cfg/cvt-cfg.pl
28
29 # -----------------------------------------------------------------------------
30 # List of all object files
31
32 OBJS =  asserts.o       \
33         bin.o           \
34         binfmt.o        \
35         cfgexpr.o       \
36         condes.o        \
37         config.o        \
38         dbgfile.o       \
39         dbginfo.o       \
40         dbgsyms.o       \
41         error.o         \
42         exports.o       \
43         expr.o          \
44         extsyms.o       \
45         fileinfo.o      \
46         fileio.o        \
47         filepath.o      \
48         fragment.o      \
49         global.o        \
50         library.o       \
51         lineinfo.o      \
52         main.o          \
53         mapfile.o       \
54         memarea.o       \
55         o65.o           \
56         objdata.o       \
57         objfile.o       \
58         scanner.o       \
59         segments.o      \
60         spool.o         \
61         tgtcfg.o
62
63 # -----------------------------------------------------------------------------
64 # List of all config includes
65
66 INCS =  apple2.inc      \
67         apple2enh.inc   \
68         atari.inc       \
69         atmos.inc       \
70         bbc.inc         \
71         c128.inc        \
72         c16.inc         \
73         c64.inc         \
74         cbm510.inc      \
75         cbm610.inc      \
76         geos.inc        \
77         lunix.inc       \
78         lynx.inc        \
79         module.inc      \
80         nes.inc         \
81         none.inc        \
82         pet.inc         \
83         plus4.inc       \
84         supervision.inc \
85         vic20.inc
86
87 LIBS = $(COMMON)/common.a
88
89
90 # ------------------------------------------------------------------------------
91 # Makefile targets
92
93 # Main target - must be first
94 .PHONY: all
95 ifeq (.depend,$(wildcard .depend))
96 all:    $(EXE)
97 include .depend
98 else
99 all:    depend
100         @$(MAKE) -f make/gcc.mak all
101 endif
102
103 $(EXE): $(INCS) $(OBJS) $(LIBS)
104         $(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
105         @if [ $(OS2_SHELL) ] ;  then $(EBIND) $(EXE) ; fi
106
107 inc:    $(INCS)
108
109 clean:
110         $(RM) *~ core.* *.map
111
112 zap:    clean
113         $(RM) *.o $(INCS) $(EXE) .depend
114
115 # ------------------------------------------------------------------------------
116 # Make the dependencies
117
118 .PHONY: depend dep
119 depend dep:     $(INCS) $(OBJS:.o=.c)
120         @echo "Creating dependency information"
121         $(CC) $(CFLAGS) -MM $(OBJS:.o=.c) > .depend
122
123 # -----------------------------------------------------------------------------
124 # Rules to make config includes
125
126 apple2.inc:     cfg/apple2.cfg
127         @$(CVT) $< $@ CfgApple2
128
129 apple2enh.inc:  cfg/apple2enh.cfg
130         @$(CVT) $< $@ CfgApple2Enh
131
132 atari.inc:      cfg/atari.cfg
133         @$(CVT) $< $@ CfgAtari
134
135 atmos.inc:      cfg/atmos.cfg
136         @$(CVT) $< $@ CfgAtmos
137
138 bbc.inc:        cfg/bbc.cfg
139         @$(CVT) $< $@ CfgBBC
140
141 c16.inc:        cfg/c16.cfg
142         @$(CVT) $< $@ CfgC16
143
144 c64.inc:        cfg/c64.cfg
145         @$(CVT) $< $@ CfgC64
146
147 c128.inc:       cfg/c128.cfg
148         @$(CVT) $< $@ CfgC128
149
150 cbm510.inc:     cfg/cbm510.cfg
151         @$(CVT) $< $@ CfgCBM510
152
153 cbm610.inc:     cfg/cbm610.cfg
154         @$(CVT) $< $@ CfgCBM610
155
156 geos.inc:       cfg/geos.cfg
157         @$(CVT) $< $@ CfgGeos
158
159 lunix.inc:      cfg/lunix.cfg
160         @$(CVT) $< $@ CfgLunix
161
162 lynx.inc:       cfg/lynx.cfg
163         @$(CVT) $< $@ CfgLynx
164
165 module.inc:     cfg/module.cfg
166         @$(CVT) $< $@ CfgModule
167
168 nes.inc:        cfg/nes.cfg
169         @$(CVT) $< $@ CfgNES
170
171 none.inc:       cfg/none.cfg
172         @$(CVT) $< $@ CfgNone
173
174 pet.inc:        cfg/pet.cfg
175         @$(CVT) $< $@ CfgPET
176
177 plus4.inc:      cfg/plus4.cfg
178         @$(CVT) $< $@ CfgPlus4
179
180 supervision.inc:        cfg/supervision.cfg
181         @$(CVT) $< $@ CfgSupervision
182
183 vic20.inc:      cfg/vic20.cfg
184         @$(CVT) $< $@ CfgVic20
185
186