]> git.sur5r.net Git - cc65/blob - src/ld65/make/gcc.mak
Changed data type used to store line numbers from unsigned long to unsigned.
[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 -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         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         memarea.o       \
54         o65.o           \
55         objdata.o       \
56         objfile.o       \
57         scanner.o       \
58         scopes.o        \
59         segments.o      \
60         span.o          \
61         spool.o         \
62         tgtcfg.o
63
64 # -----------------------------------------------------------------------------
65 # List of all config includes
66
67 INCS =  apple2.inc      \
68         apple2enh.inc   \
69         atari.inc       \
70         atmos.inc       \
71         bbc.inc         \
72         c128.inc        \
73         c16.inc         \
74         c64.inc         \
75         cbm510.inc      \
76         cbm610.inc      \
77         geos.inc        \
78         lunix.inc       \
79         lynx.inc        \
80         module.inc      \
81         nes.inc         \
82         none.inc        \
83         pet.inc         \
84         plus4.inc       \
85         supervision.inc \
86         vic20.inc
87
88 LIBS = $(COMMON)/common.a
89
90
91 # ------------------------------------------------------------------------------
92 # Makefile targets
93
94 # Main target - must be first
95 .PHONY: all
96 ifeq (.depend,$(wildcard .depend))
97 all:    $(EXE)
98 include .depend
99 else
100 all:    depend
101         @$(MAKE) -f make/gcc.mak all
102 endif
103
104 $(EXE): $(INCS) $(OBJS) $(LIBS)
105         $(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
106         @if [ $(OS2_SHELL) ] ;  then $(EBIND) $(EXE) ; fi
107
108 inc:    $(INCS)
109
110 clean:
111         $(RM) *~ core.* *.map
112
113 zap:    clean
114         $(RM) *.o $(INCS) $(EXE) .depend
115
116 # ------------------------------------------------------------------------------
117 # Make the dependencies
118
119 .PHONY: depend dep
120 depend dep:     $(INCS) $(OBJS:.o=.c)
121         @echo "Creating dependency information"
122         $(CC) $(CFLAGS) -MM $(OBJS:.o=.c) > .depend
123
124 # -----------------------------------------------------------------------------
125 # Rules to make config includes
126
127 apple2.inc:     cfg/apple2.cfg
128         @$(CVT) $< $@ CfgApple2
129
130 apple2enh.inc:  cfg/apple2enh.cfg
131         @$(CVT) $< $@ CfgApple2Enh
132
133 atari.inc:      cfg/atari.cfg
134         @$(CVT) $< $@ CfgAtari
135
136 atmos.inc:      cfg/atmos.cfg
137         @$(CVT) $< $@ CfgAtmos
138
139 bbc.inc:        cfg/bbc.cfg
140         @$(CVT) $< $@ CfgBBC
141
142 c16.inc:        cfg/c16.cfg
143         @$(CVT) $< $@ CfgC16
144
145 c64.inc:        cfg/c64.cfg
146         @$(CVT) $< $@ CfgC64
147
148 c128.inc:       cfg/c128.cfg
149         @$(CVT) $< $@ CfgC128
150
151 cbm510.inc:     cfg/cbm510.cfg
152         @$(CVT) $< $@ CfgCBM510
153
154 cbm610.inc:     cfg/cbm610.cfg
155         @$(CVT) $< $@ CfgCBM610
156
157 geos.inc:       cfg/geos.cfg
158         @$(CVT) $< $@ CfgGeos
159
160 lunix.inc:      cfg/lunix.cfg
161         @$(CVT) $< $@ CfgLunix
162
163 lynx.inc:       cfg/lynx.cfg
164         @$(CVT) $< $@ CfgLynx
165
166 module.inc:     cfg/module.cfg
167         @$(CVT) $< $@ CfgModule
168
169 nes.inc:        cfg/nes.cfg
170         @$(CVT) $< $@ CfgNES
171
172 none.inc:       cfg/none.cfg
173         @$(CVT) $< $@ CfgNone
174
175 pet.inc:        cfg/pet.cfg
176         @$(CVT) $< $@ CfgPET
177
178 plus4.inc:      cfg/plus4.cfg
179         @$(CVT) $< $@ CfgPlus4
180
181 supervision.inc:        cfg/supervision.cfg
182         @$(CVT) $< $@ CfgSupervision
183
184 vic20.inc:      cfg/vic20.cfg
185         @$(CVT) $< $@ CfgVic20
186
187