]> git.sur5r.net Git - cc65/blob - src/ld65/make/gcc.mak
Changed the makefiles to work under OS/2 using EMX (Changes from
[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         fileio.o        \
31         fragment.o      \
32         global.o        \
33         library.o       \
34         main.o          \
35         mapfile.o       \
36         o65.o           \
37         objdata.o       \
38         objfile.o       \
39         scanner.o       \
40         segments.o      \
41         tgtcfg.o
42
43 # -----------------------------------------------------------------------------
44 # List of all config includes
45
46 INCS =  apple2.inc      \
47         atari.inc       \
48         bbc.inc         \
49         c64.inc         \
50         c128.inc        \
51         cbm610.inc      \
52         geos.inc        \
53         none.inc        \
54         pet.inc         \
55         plus4.inc
56
57 # -----------------------------------------------------------------------------
58 #
59
60 LIBS = $(COMMON)/common.a
61
62
63 EXECS = ld65
64
65 .PHONY: all
66 ifeq (.depend,$(wildcard .depend))
67 all : $(EXECS)
68 include .depend
69 else
70 all:    depend
71         @$(MAKE) -f make/gcc.mak all
72 endif
73
74
75
76 ld65:   $(INCS) $(OBJS) $(LIBS)
77         $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
78         @if [ $(OS2_SHELL) ] ;  then $(EBIND) $@ ; fi
79
80 inc:    $(INCS)
81
82 clean:
83         rm -f *~ core *.map
84
85 zap:    clean
86         rm -f *.o $(INCS) $(EXECS) .depend
87
88
89 # ------------------------------------------------------------------------------
90 # Make the dependencies
91
92 .PHONY: depend dep
93 depend dep:     $(OBJS:.o=.c)
94         @echo "Creating dependency information"
95         $(CC) -I$(COMMON) -MM -MG $^ > .depend
96
97 # -----------------------------------------------------------------------------
98 # Rules to make config includes
99
100 apple2.inc:     cfg/apple2.cfg
101         @$(CVT) $< $@ CfgApple2
102
103 atari.inc:      cfg/atari.cfg
104         @$(CVT) $< $@ CfgAtari
105
106 bbc.inc:        cfg/bbc.cfg
107         @$(CVT) $< $@ CfgBBC
108
109 c64.inc:        cfg/c64.cfg
110         @$(CVT) $< $@ CfgC64
111
112 c128.inc:       cfg/c128.cfg
113         @$(CVT) $< $@ CfgC128
114
115 cbm610.inc:     cfg/cbm610.cfg
116         @$(CVT) $< $@ CfgCBM610
117
118 geos.inc:       cfg/geos.cfg
119         @$(CVT) $< $@ CfgGeos
120
121 none.inc:       cfg/none.cfg
122         @$(CVT) $< $@ CfgNone
123
124 pet.inc:        cfg/pet.cfg
125         @$(CVT) $< $@ CfgPET
126
127 plus4.inc:      cfg/plus4.cfg
128         @$(CVT) $< $@ CfgPlus4
129
130