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