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