]> git.sur5r.net Git - cc65/blob - src/ld65/make/gcc.mak
Use a separate structure for file infos instead of just the name.
[cc65] / src / ld65 / make / gcc.mak
1 #
2 # gcc Makefile for ld65
3 #
4
5 # Library dir
6 COMMON  = ../common
7
8 # Default for the compiler lib search path as compiler define
9 CDEFS=-DCC65_LIB=\"/usr/lib/cc65/lib/\"
10 CFLAGS = -g -O2 -Wall -I$(COMMON) $(CDEFS)
11 CC=gcc
12 EBIND=emxbind
13 LDFLAGS=
14
15 # Perl script for config file conversion
16 CVT=cfg/cvt-cfg.pl
17
18 # -----------------------------------------------------------------------------
19 # List of all object files
20
21 OBJS =  bin.o           \
22         binfmt.o        \
23         condes.o        \
24         config.o        \
25         dbgsyms.o       \
26         error.o         \
27         exports.o       \
28         expr.o          \
29         extsyms.o       \
30         fileinfo.o      \
31         fileio.o        \
32         fragment.o      \
33         global.o        \
34         library.o       \
35         lineinfo.o      \
36         main.o          \
37         mapfile.o       \
38         o65.o           \
39         objdata.o       \
40         objfile.o       \
41         scanner.o       \
42         segments.o      \
43         tgtcfg.o
44
45 # -----------------------------------------------------------------------------
46 # List of all config includes
47
48 INCS =  apple2.inc      \
49         atari.inc       \
50         bbc.inc         \
51         c64.inc         \
52         c128.inc        \
53         cbm610.inc      \
54         geos.inc        \
55         none.inc        \
56         pet.inc         \
57         plus4.inc
58
59 # -----------------------------------------------------------------------------
60 #
61
62 LIBS = $(COMMON)/common.a
63
64
65 EXECS = ld65
66
67 .PHONY: all
68 ifeq (.depend,$(wildcard .depend))
69 all : $(EXECS)
70 include .depend
71 else
72 all:    depend
73         @$(MAKE) -f make/gcc.mak all
74 endif
75
76
77
78 ld65:   $(INCS) $(OBJS) $(LIBS)
79         $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
80         @if [ $(OS2_SHELL) ] ;  then $(EBIND) $@ ; fi
81
82 inc:    $(INCS)
83
84 clean:
85         rm -f *~ core *.map
86
87 zap:    clean
88         rm -f *.o $(INCS) $(EXECS) .depend
89
90
91 # ------------------------------------------------------------------------------
92 # Make the dependencies
93
94 .PHONY: depend dep
95 depend dep:     $(OBJS:.o=.c)
96         @echo "Creating dependency information"
97         $(CC) -I$(COMMON) -MM -MG $^ > .depend
98
99 # -----------------------------------------------------------------------------
100 # Rules to make config includes
101
102 apple2.inc:     cfg/apple2.cfg
103         @$(CVT) $< $@ CfgApple2
104
105 atari.inc:      cfg/atari.cfg
106         @$(CVT) $< $@ CfgAtari
107
108 bbc.inc:        cfg/bbc.cfg
109         @$(CVT) $< $@ CfgBBC
110
111 c64.inc:        cfg/c64.cfg
112         @$(CVT) $< $@ CfgC64
113
114 c128.inc:       cfg/c128.cfg
115         @$(CVT) $< $@ CfgC128
116
117 cbm610.inc:     cfg/cbm610.cfg
118         @$(CVT) $< $@ CfgCBM610
119
120 geos.inc:       cfg/geos.cfg
121         @$(CVT) $< $@ CfgGeos
122
123 none.inc:       cfg/none.cfg
124         @$(CVT) $< $@ CfgNone
125
126 pet.inc:        cfg/pet.cfg
127         @$(CVT) $< $@ CfgPET
128
129 plus4.inc:      cfg/plus4.cfg
130         @$(CVT) $< $@ CfgPlus4
131
132