]> git.sur5r.net Git - cc65/blob - src/ca65/make/gcc.mak
f3d94985fe06dbe463da409b0d9ea9f43bdb2c52
[cc65] / src / ca65 / make / gcc.mak
1 #
2 # gcc Makefile for ca65
3 #
4
5 # ------------------------------------------------------------------------------
6
7 # The executable to build
8 EXE     = ca65
9
10 # Library dir
11 COMMON  = ../common
12
13 # Several search paths. You may redefine these on the command line
14 CA65_INC = \"/usr/lib/cc65/asminc/\"
15
16 #
17 CC      = gcc
18 CFLAGS  = -g -O2 -Wall -W -std=c89
19 override CFLAGS += -I$(COMMON)
20 override CFLAGS += -DCA65_INC=$(CA65_INC)
21 EBIND   = emxbind
22 LDFLAGS =
23
24 # Perl script for macro file conversion
25 CVT=macpack/cvt-mac.pl
26
27 # -----------------------------------------------------------------------------
28 # List of all object files
29
30 OBJS =  anonname.o      \
31         asserts.o       \
32         condasm.o       \
33         dbginfo.o       \
34         ea65.o          \
35         easw16.o        \
36         enum.o          \
37         error.o         \
38         expr.o          \
39         feature.o       \
40         filetab.o       \
41         fragment.o      \
42         global.o        \
43         incpath.o       \
44         instr.o         \
45         istack.o        \
46         lineinfo.o      \
47         listing.o       \
48         macpack.o       \
49         macro.o         \
50         main.o          \
51         nexttok.o       \
52         objcode.o       \
53         objfile.o       \
54         options.o       \
55         pseudo.o        \
56         repeat.o        \
57         scanner.o       \
58         segment.o       \
59         segrange.o      \
60         sizeof.o        \
61         spool.o         \
62         struct.o        \
63         studyexpr.o     \
64         symentry.o      \
65         symbol.o        \
66         symtab.o        \
67         token.o         \
68         toklist.o       \
69         ulabel.o
70
71 # -----------------------------------------------------------------------------
72 # List of all macro files
73
74 INCS =  atari.inc       \
75         cbm.inc         \
76         cpu.inc         \
77         generic.inc     \
78         longbranch.inc
79
80 LIBS = $(COMMON)/common.a
81
82 # ------------------------------------------------------------------------------
83 # Makefile targets
84
85 # Main target - must be first
86 .PHONY: all
87 ifeq (.depend,$(wildcard .depend))
88 all:    $(EXE)
89 include .depend
90 else
91 all:    depend
92         @$(MAKE) -f make/gcc.mak all
93 endif
94
95 $(EXE): $(INCS) $(OBJS) $(LIBS)
96         $(CC) $(OBJS) $(LIBS) $(LDFLAGS) -o $@
97         @if [ $(OS2_SHELL) ] ;  then $(EBIND) $(EXE) ; fi
98
99 inc:    $(INCS)
100
101 clean:
102         $(RM) *~ core.* *.map
103
104 zap:    clean
105         $(RM) *.o $(EXE) $(INCS) .depend
106
107 # ------------------------------------------------------------------------------
108 # Make the dependencies
109
110 .PHONY: depend dep
111 depend dep:     $(INCS) $(OBJS:.o=.c)
112         @echo "Creating dependency information"
113         $(CC) $(CFLAGS) -MM $(OBJS:.o=.c) > .depend
114
115 # -----------------------------------------------------------------------------
116 # Rules to make config includes
117
118 atari.inc:      macpack/atari.mac
119         @$(CVT) $< $@ MacAtari
120
121 cbm.inc:        macpack/cbm.mac
122         @$(CVT) $< $@ MacCBM
123
124 cpu.inc:        macpack/cpu.mac
125         @$(CVT) $< $@ MacCPU
126
127 generic.inc:    macpack/generic.mac
128         @$(CVT) $< $@ MacGeneric
129
130 longbranch.inc: macpack/longbranch.mac
131         @$(CVT) $< $@ MacLongBranch
132
133
134
135
136
137
138
139
140
141