sdk/Build System: Improved the bootstrap Makefiles
[sdk] / compiler / bootstrap / libec / Makefile
1 .PHONY: all objdir clean realclean distclean
2
3 # CORE VARIABLES
4
5 MODULE := ec
6 CONFIG := bootstrap
7 ifndef COMPILER
8 COMPILER := default
9 endif
10
11 TARGET_TYPE = staticlib
12
13 # FLAGS
14
15 ECFLAGS =
16 ifndef DEBIAN_PACKAGE
17 CFLAGS =
18 endif
19 CECFLAGS =
20 OFLAGS =
21 LDFLAGS =
22 LIBS =
23
24 ifdef DEBUG
25 NOSTRIP := y
26 endif
27
28 CONSOLE = -mwindows
29
30 # INCLUDES
31
32 _CF_DIR = ../../../
33
34 include $(_CF_DIR)crossplatform.mk
35 include $(_CF_DIR)default.cf
36
37 # POST-INCLUDES VARIABLES
38
39 OBJ = obj/$(CONFIG).$(PLATFORM)$(COMPILER_SUFFIX)$(DEBUG_SUFFIX)/
40
41 RES = 
42
43 TARGET = obj/$(CONFIG).$(PLATFORM)$(COMPILER_SUFFIX)$(DEBUG_SUFFIX)/$(LP)ecBootstrap$(A)
44
45 OBJECTS = \
46         $(OBJ)ast.o \
47         $(OBJ)copy.o \
48         $(OBJ)dbpass.o \
49         $(OBJ)ec.main.o \
50         $(OBJ)ecdefs.o \
51         $(OBJ)expression.o \
52         $(OBJ)firstPass.o \
53         $(OBJ)freeAst.o \
54         $(OBJ)grammar.o \
55         $(OBJ)lexer.o \
56         $(OBJ)loadSymbols.o \
57         $(OBJ)output.o \
58         $(OBJ)pass0.o \
59         $(OBJ)pass1.o \
60         $(OBJ)pass15.o \
61         $(OBJ)pass16.o \
62         $(OBJ)pass2.o \
63         $(OBJ)pass3.o \
64         $(OBJ)shortcuts.o \
65         $(OBJ)type.o \
66         $(OBJ)bsl.o
67
68 SOURCES = \
69         bootstrap/ast.c \
70         bootstrap/copy.c \
71         bootstrap/dbpass.c \
72         bootstrap/ec.main.c \
73         bootstrap/ecdefs.c \
74         bootstrap/expression.c \
75         bootstrap/firstPass.c \
76         bootstrap/freeAst.c \
77         bootstrap/grammar.c \
78         bootstrap/lexer.c \
79         bootstrap/loadSymbols.c \
80         bootstrap/output.c \
81         bootstrap/pass0.c \
82         bootstrap/pass1.c \
83         bootstrap/pass15.c \
84         bootstrap/pass16.c \
85         bootstrap/pass2.c \
86         bootstrap/pass3.c \
87         bootstrap/shortcuts.c \
88         bootstrap/type.c \
89         ../bsl.c
90
91 LIBS += $(SHAREDLIB) $(EXECUTABLE) $(LINKOPT)
92
93 ifndef STATIC_LIBRARY_TARGET
94 LIBS +=
95 endif
96
97 CFLAGS += \
98          $(if $(DEBIAN_PACKAGE),$(CPPFLAGS),) $(if $(DEBUG), -D_DEBUG,) \
99          $(if $(DEBUG), -g, -O2 -ffast-math) $(FORCE_32_BIT) $(FPIC) -w \
100                          -DECERE_STATIC
101 ECFLAGS += \
102          -nolinenumbers
103
104
105
106
107 CECFLAGS += -cpp $(_CPP)
108
109 ifndef STATIC_LIBRARY_TARGET
110 OFLAGS += $(FORCE_32_BIT)
111 OFLAGS += $(LDFLAGS)
112 endif
113
114 # TARGETS
115
116 all: objdir $(TARGET)
117
118 objdir:
119         $(if $(wildcard $(OBJ)),,$(call mkdirq,$(OBJ)))
120
121 $(TARGET): $(SOURCES) $(RESOURCES) | objdir $(SYMBOLS) $(OBJECTS)
122         $(AR) rcs $(TARGET) $(OBJECTS) $(LIBS)
123
124 # OBJECT RULES
125
126 $(OBJ)ast.o: bootstrap/ast.c
127         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/ast.c -o $(OBJ)ast.o
128
129 $(OBJ)copy.o: bootstrap/copy.c
130         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/copy.c -o $(OBJ)copy.o
131
132 $(OBJ)dbpass.o: bootstrap/dbpass.c
133         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/dbpass.c -o $(OBJ)dbpass.o
134
135 $(OBJ)ec.main.o: bootstrap/ec.main.c
136         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/ec.main.c -o $(OBJ)ec.main.o
137
138 $(OBJ)ecdefs.o: bootstrap/ecdefs.c
139         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/ecdefs.c -o $(OBJ)ecdefs.o
140
141 $(OBJ)expression.o: bootstrap/expression.c
142         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/expression.c -o $(OBJ)expression.o
143
144 $(OBJ)firstPass.o: bootstrap/firstPass.c
145         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/firstPass.c -o $(OBJ)firstPass.o
146
147 $(OBJ)freeAst.o: bootstrap/freeAst.c
148         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/freeAst.c -o $(OBJ)freeAst.o
149
150 $(OBJ)grammar.o: bootstrap/grammar.c
151         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/grammar.c -o $(OBJ)grammar.o
152
153 $(OBJ)lexer.o: bootstrap/lexer.c
154         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/lexer.c -o $(OBJ)lexer.o
155
156 $(OBJ)loadSymbols.o: bootstrap/loadSymbols.c
157         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/loadSymbols.c -o $(OBJ)loadSymbols.o
158
159 $(OBJ)output.o: bootstrap/output.c
160         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/output.c -o $(OBJ)output.o
161
162 $(OBJ)pass0.o: bootstrap/pass0.c
163         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/pass0.c -o $(OBJ)pass0.o
164
165 $(OBJ)pass1.o: bootstrap/pass1.c
166         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/pass1.c -o $(OBJ)pass1.o
167
168 $(OBJ)pass15.o: bootstrap/pass15.c
169         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/pass15.c -o $(OBJ)pass15.o
170
171 $(OBJ)pass16.o: bootstrap/pass16.c
172         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/pass16.c -o $(OBJ)pass16.o
173
174 $(OBJ)pass2.o: bootstrap/pass2.c
175         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/pass2.c -o $(OBJ)pass2.o
176
177 $(OBJ)pass3.o: bootstrap/pass3.c
178         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/pass3.c -o $(OBJ)pass3.o
179
180 $(OBJ)shortcuts.o: bootstrap/shortcuts.c
181         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/shortcuts.c -o $(OBJ)shortcuts.o
182
183 $(OBJ)type.o: bootstrap/type.c
184         $(CC) $(CFLAGS) $(FVISIBILITY) -c bootstrap/type.c -o $(OBJ)type.o
185
186 $(OBJ)bsl.o: ../bsl.c
187         $(CC) $(CFLAGS) $(FVISIBILITY) -c ../bsl.c -o $(OBJ)bsl.o
188
189 clean: objdir
190         $(call rmq,$(TARGET))
191         $(call rmq,$(OBJECTS))
192
193 realclean: clean
194         $(call rmrq,$(OBJ))
195
196 distclean:
197         $(call rmrq,obj/)