|
@@ -1,50 +1,10 @@
|
1
|
1
|
# -*- makefile -*- : Force emacs to use Makefile mode
|
2
|
|
-
|
|
2
|
+#
|
3
|
3
|
# This file contains various boring housekeeping functions that would
|
4
|
4
|
# otherwise seriously clutter up the main Makefile.
|
5
|
5
|
|
6
|
|
-# Objects to be removed by "make clean"
|
7
|
|
-#
|
8
|
|
-CLEANUP := $(BIN)/*.* # *.* to avoid catching the "CVS" directory
|
9
|
|
-
|
10
|
|
-# Version number calculations
|
|
6
|
+###############################################################################
|
11
|
7
|
#
|
12
|
|
-VERSION_MAJOR = 0
|
13
|
|
-VERSION_MINOR = 9
|
14
|
|
-VERSION_PATCH = 5
|
15
|
|
-EXTRAVERSION = +
|
16
|
|
-MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
|
17
|
|
-VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
|
18
|
|
-CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) \
|
19
|
|
- -DVERSION_MINOR=$(VERSION_MINOR) \
|
20
|
|
- -DVERSION=\"$(VERSION)\"
|
21
|
|
-IDENT = '$(@F) $(VERSION) (GPL) etherboot.org'
|
22
|
|
-version :
|
23
|
|
- @$(ECHO) $(VERSION)
|
24
|
|
-
|
25
|
|
-configure :
|
26
|
|
- @$(ECHO) "No configuration needed."
|
27
|
|
-
|
28
|
|
-install :
|
29
|
|
- @$(ECHO) "No installation required. Generated images will be placed in the" $(BIN) "directory."
|
30
|
|
-
|
31
|
|
-# Check for tools that can cause failed builds
|
32
|
|
-#
|
33
|
|
-.toolcheck : Makefile
|
34
|
|
- @if $(CC) -v 2>&1 | grep -is 'gcc version 2\.96' > /dev/null; then \
|
35
|
|
- $(ECHO) 'gcc 2.96 is unsuitable for compiling Etherboot'; \
|
36
|
|
- $(ECHO) 'Use gcc 2.95 or gcc 3.x instead'; \
|
37
|
|
- exit 1; \
|
38
|
|
- fi
|
39
|
|
- @if [ `perl -e 'use bytes; print chr(255)' | wc -c` = 2 ]; then \
|
40
|
|
- $(ECHO) 'Your Perl version has a Unicode handling bug'; \
|
41
|
|
- $(ECHO) 'Execute this command before compiling Etherboot:'; \
|
42
|
|
- $(ECHO) 'export LANG=$${LANG%.UTF-8}'; \
|
43
|
|
- exit 1; \
|
44
|
|
- fi
|
45
|
|
- @$(TOUCH) $@
|
46
|
|
-VERYCLEANUP += .toolcheck
|
47
|
|
-
|
48
|
8
|
# Find a usable "echo -e" substitute.
|
49
|
9
|
#
|
50
|
10
|
TAB := $(shell $(PRINTF) '\t')
|
|
@@ -86,20 +46,36 @@ else
|
86
|
46
|
@$(ECHO) "No usable \"echo -e\" substitute found"
|
87
|
47
|
@exit 1
|
88
|
48
|
endif
|
|
49
|
+MAKEDEPS += .echocheck
|
89
|
50
|
VERYCLEANUP += .echocheck
|
90
|
51
|
|
91
|
52
|
echo :
|
92
|
53
|
@$(ECHO) "Using \"$(ECHO_E)\" for \"echo -e\""
|
93
|
54
|
|
94
|
|
-# Build verbosity
|
|
55
|
+###############################################################################
|
|
56
|
+#
|
|
57
|
+# Check for tools that can cause failed builds
|
|
58
|
+#
|
|
59
|
+.toolcheck :
|
|
60
|
+ @if $(CC) -v 2>&1 | grep -is 'gcc version 2\.96' > /dev/null; then \
|
|
61
|
+ $(ECHO) 'gcc 2.96 is unsuitable for compiling Etherboot'; \
|
|
62
|
+ $(ECHO) 'Use gcc 2.95 or gcc 3.x instead'; \
|
|
63
|
+ exit 1; \
|
|
64
|
+ fi
|
|
65
|
+ @if [ `perl -e 'use bytes; print chr(255)' | wc -c` = 2 ]; then \
|
|
66
|
+ $(ECHO) 'Your Perl version has a Unicode handling bug'; \
|
|
67
|
+ $(ECHO) 'Execute this command before compiling Etherboot:'; \
|
|
68
|
+ $(ECHO) 'export LANG=$${LANG%.UTF-8}'; \
|
|
69
|
+ exit 1; \
|
|
70
|
+ fi
|
|
71
|
+ @$(TOUCH) $@
|
|
72
|
+MAKEDEPS += .toolcheck
|
|
73
|
+VERYCLEANUP += .toolcheck
|
|
74
|
+
|
|
75
|
+###############################################################################
|
|
76
|
+#
|
|
77
|
+# Check for various tool workarounds
|
95
|
78
|
#
|
96
|
|
-ifeq ($(V),1)
|
97
|
|
-Q =
|
98
|
|
-QM = @\#
|
99
|
|
-else
|
100
|
|
-Q = @
|
101
|
|
-QM = @
|
102
|
|
-endif
|
103
|
79
|
|
104
|
80
|
# Check for an old version of gas (binutils 2.9.1)
|
105
|
81
|
#
|
|
@@ -117,15 +93,157 @@ SP_TEST = $(CC) -fno-stack-protector -x c -c /dev/null \
|
117
|
93
|
SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector')
|
118
|
94
|
CFLAGS += $(SP_FLAGS)
|
119
|
95
|
|
120
|
|
-# compiler.h is needed for our linking and debugging system
|
|
96
|
+###############################################################################
|
|
97
|
+#
|
|
98
|
+# Build verbosity
|
|
99
|
+#
|
|
100
|
+ifeq ($(V),1)
|
|
101
|
+Q :=
|
|
102
|
+QM := @\#
|
|
103
|
+else
|
|
104
|
+Q := @
|
|
105
|
+QM := @
|
|
106
|
+endif
|
|
107
|
+
|
|
108
|
+###############################################################################
|
|
109
|
+#
|
|
110
|
+# Set BIN according to whatever was specified on the command line as
|
|
111
|
+# the build target.
|
121
|
112
|
#
|
122
|
|
-CFLAGS += -include compiler.h
|
123
|
113
|
|
|
114
|
+# Determine how many different BIN directories are mentioned in the
|
|
115
|
+# make goals.
|
|
116
|
+#
|
|
117
|
+BIN_GOALS := $(filter bin/% bin-%,$(MAKECMDGOALS))
|
|
118
|
+BIN_GOAL_BINS := $(foreach BG,$(BIN_GOALS),$(firstword $(subst /, ,$(BG))))
|
|
119
|
+NUM_BINS := $(words $(sort $(BIN_GOAL_BINS)))
|
|
120
|
+
|
|
121
|
+ifeq ($(NUM_BINS),0)
|
|
122
|
+
|
|
123
|
+# No BIN directory was specified. Set BIN to "bin" as a sensible
|
|
124
|
+# default.
|
|
125
|
+
|
|
126
|
+BIN := bin
|
|
127
|
+
|
|
128
|
+else # NUM_BINS == 0
|
|
129
|
+
|
|
130
|
+ifeq ($(NUM_BINS),1)
|
|
131
|
+
|
|
132
|
+# If exactly one BIN directory was specified, set BIN to match this
|
|
133
|
+# directory.
|
|
134
|
+#
|
|
135
|
+BIN := $(firstword $(BIN_GOAL_BINS))
|
|
136
|
+
|
|
137
|
+else # NUM_BINS == 1
|
|
138
|
+
|
|
139
|
+# More than one BIN directory was specified. We cannot handle the
|
|
140
|
+# latter case within a single make invocation, so set up recursive
|
|
141
|
+# targets for each BIN directory.
|
|
142
|
+#
|
|
143
|
+# Leave $(BIN) undefined. This has implications for any target that
|
|
144
|
+# depends on $(BIN); such targets should be made conditional upon the
|
|
145
|
+# existence of $(BIN).
|
|
146
|
+#
|
|
147
|
+$(BIN_GOALS) : % : BIN_RECURSE
|
|
148
|
+ $(Q)$(MAKE) --no-print-directory BIN=$(firstword $(subst /, ,$@)) $@
|
|
149
|
+.PHONY : BIN_RECURSE
|
|
150
|
+
|
|
151
|
+endif # NUM_BINS == 1
|
|
152
|
+endif # NUM_BINS == 0
|
|
153
|
+
|
|
154
|
+ifdef BIN
|
|
155
|
+
|
|
156
|
+# Create $(BIN) directory if it doesn't exist yet
|
|
157
|
+#
|
|
158
|
+ifeq ($(wildcard $(BIN)),)
|
|
159
|
+$(shell $(MKDIR) -p $(BIN))
|
|
160
|
+endif
|
|
161
|
+
|
|
162
|
+# Target to allow e.g. "make bin-efi arch"
|
|
163
|
+#
|
|
164
|
+$(BIN) :
|
|
165
|
+ @# Do nothing, silently
|
|
166
|
+.PHONY : $(BIN)
|
|
167
|
+
|
|
168
|
+# Remove everything in $(BIN) for a "make clean"
|
|
169
|
+#
|
|
170
|
+CLEANUP += $(BIN)/*.* # Avoid picking up directories
|
|
171
|
+
|
|
172
|
+endif # defined(BIN)
|
|
173
|
+
|
|
174
|
+# Determine whether or not we need to include the dependency files
|
|
175
|
+#
|
|
176
|
+NO_DEP_TARGETS := $(BIN) clean veryclean
|
|
177
|
+ifeq ($(MAKECMDGOALS),)
|
|
178
|
+NEED_DEPS := 1
|
|
179
|
+endif
|
|
180
|
+ifneq ($(strip $(filter-out $(NO_DEP_TARGETS),$(MAKECMDGOALS))),)
|
|
181
|
+NEED_DEPS := 1
|
|
182
|
+endif
|
|
183
|
+
|
|
184
|
+###############################################################################
|
|
185
|
+#
|
|
186
|
+# Select build architecture and platform based on $(BIN)
|
|
187
|
+#
|
|
188
|
+# BIN has the form bin[-[arch-]platform]
|
|
189
|
+
|
|
190
|
+ARCHS := $(patsubst arch/%,%,$(wildcard arch/*))
|
|
191
|
+PLATFORMS := $(patsubst config/defaults/%.h,%,\
|
|
192
|
+ $(wildcard config/defaults/*.h))
|
|
193
|
+archs :
|
|
194
|
+ @$(ECHO) $(ARCHS)
|
|
195
|
+
|
|
196
|
+platforms :
|
|
197
|
+ @$(ECHO) $(PLATFORMS)
|
|
198
|
+
|
|
199
|
+ifdef BIN
|
|
200
|
+
|
|
201
|
+# Determine architecture portion of $(BIN), if present
|
|
202
|
+BIN_ARCH := $(strip $(foreach A,$(ARCHS),\
|
|
203
|
+ $(patsubst bin-$(A)-%,$(A),\
|
|
204
|
+ $(filter bin-$(A)-%,$(BIN)))))
|
|
205
|
+
|
|
206
|
+# Determine platform portion of $(BIN), if present
|
|
207
|
+ifeq ($(BIN_ARCH),)
|
|
208
|
+BIN_PLATFORM := $(patsubst bin-%,%,$(filter bin-%,$(BIN)))
|
|
209
|
+else
|
|
210
|
+BIN_PLATFORM := $(patsubst bin-$(BIN_ARCH)-%,%,$(BIN))
|
|
211
|
+endif
|
|
212
|
+
|
|
213
|
+# Determine build architecture
|
|
214
|
+DEFAULT_ARCH := i386
|
|
215
|
+ARCH := $(firstword $(BIN_ARCH) $(DEFAULT_ARCH))
|
|
216
|
+CFLAGS += -DARCH=$(ARCH)
|
|
217
|
+arch :
|
|
218
|
+ @$(ECHO) $(ARCH)
|
|
219
|
+.PHONY : arch
|
|
220
|
+
|
|
221
|
+# Determine build platform
|
|
222
|
+DEFAULT_PLATFORM := pcbios
|
|
223
|
+PLATFORM := $(firstword $(BIN_PLATFORM) $(DEFAULT_PLATFORM))
|
|
224
|
+CFLAGS += -DPLATFORM=$(PLATFORM)
|
|
225
|
+platform :
|
|
226
|
+ @$(ECHO) $(PLATFORM)
|
|
227
|
+
|
|
228
|
+endif # defined(BIN)
|
|
229
|
+
|
|
230
|
+# Include architecture-specific Makefile
|
|
231
|
+ifdef ARCH
|
|
232
|
+include arch/$(ARCH)/Makefile
|
|
233
|
+endif
|
|
234
|
+
|
|
235
|
+###############################################################################
|
|
236
|
+#
|
124
|
237
|
# config/%.h files are generated from config.h using mkconfig.pl
|
|
238
|
+#
|
125
|
239
|
config/%.h : config*.h
|
126
|
240
|
$(MKCONFIG) config.h
|
127
|
241
|
CLEANUP += config/*.h
|
128
|
242
|
|
|
243
|
+###############################################################################
|
|
244
|
+#
|
|
245
|
+# Source file handling
|
|
246
|
+
|
129
|
247
|
# SRCDIRS lists all directories containing source files.
|
130
|
248
|
srcdirs :
|
131
|
249
|
@$(ECHO) $(SRCDIRS)
|
|
@@ -145,6 +263,67 @@ AUTO_SRCS = $(filter-out $(NON_AUTO_SRCS),$(SRCS))
|
145
|
263
|
autosrcs :
|
146
|
264
|
@$(ECHO) $(AUTO_SRCS)
|
147
|
265
|
|
|
266
|
+# Just about everything else in this section depends upon having
|
|
267
|
+# $(BIN) set
|
|
268
|
+
|
|
269
|
+ifdef BIN
|
|
270
|
+
|
|
271
|
+# Common flags
|
|
272
|
+#
|
|
273
|
+CFLAGS += -I include -I arch/$(ARCH)/include -I .
|
|
274
|
+CFLAGS += -Os -ffreestanding
|
|
275
|
+CFLAGS += -Wall -W
|
|
276
|
+CFLAGS += -g
|
|
277
|
+CFLAGS += $(EXTRA_CFLAGS)
|
|
278
|
+ASFLAGS += $(EXTRA_ASFLAGS)
|
|
279
|
+LDFLAGS += $(EXTRA_LDFLAGS)
|
|
280
|
+
|
|
281
|
+# Embedded image, if present
|
|
282
|
+#
|
|
283
|
+EMBEDDED_IMAGE = /dev/null
|
|
284
|
+
|
|
285
|
+# Inhibit -Werror if NO_WERROR is specified on make command line
|
|
286
|
+#
|
|
287
|
+ifneq ($(NO_WERROR),1)
|
|
288
|
+CFLAGS += -Werror
|
|
289
|
+endif
|
|
290
|
+
|
|
291
|
+# compiler.h is needed for our linking and debugging system
|
|
292
|
+#
|
|
293
|
+CFLAGS += -include compiler.h
|
|
294
|
+
|
|
295
|
+# CFLAGS for specific object types
|
|
296
|
+#
|
|
297
|
+CFLAGS_c +=
|
|
298
|
+CFLAGS_S += -DASSEMBLY
|
|
299
|
+
|
|
300
|
+# Base object name of the current target
|
|
301
|
+#
|
|
302
|
+OBJECT = $(firstword $(subst ., ,$(@F)))
|
|
303
|
+
|
|
304
|
+# CFLAGS for specific object files. You can define
|
|
305
|
+# e.g. CFLAGS_rtl8139, and have those flags automatically used when
|
|
306
|
+# compiling bin/rtl8139.o.
|
|
307
|
+#
|
|
308
|
+OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
|
|
309
|
+$(BIN)/%.flags :
|
|
310
|
+ @$(ECHO) $(OBJ_CFLAGS)
|
|
311
|
+
|
|
312
|
+# Rules for specific object types.
|
|
313
|
+#
|
|
314
|
+COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
|
|
315
|
+RULE_c = $(Q)$(COMPILE_c) -c $< -o $@
|
|
316
|
+RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -Ddebug_$(OBJECT)=$* -c $< -o $@
|
|
317
|
+RULE_c_to_c = $(Q)$(COMPILE_c) -E -c $< > $@
|
|
318
|
+RULE_c_to_s = $(Q)$(COMPILE_c) -S -g0 -c $< -o $@
|
|
319
|
+
|
|
320
|
+PREPROCESS_S = $(CPP) $(CFLAGS) $(CFLAGS_S) $(OBJ_CFLAGS)
|
|
321
|
+ASSEMBLE_S = $(AS) $(ASFLAGS)
|
|
322
|
+RULE_S = $(Q)$(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@
|
|
323
|
+RULE_S_to_s = $(Q)$(PREPROCESS_S) $< > $@
|
|
324
|
+
|
|
325
|
+DEBUG_TARGETS += dbg%.o c s
|
|
326
|
+
|
148
|
327
|
# We automatically generate rules for any file mentioned in AUTO_SRCS
|
149
|
328
|
# using the following set of templates. It would be cleaner to use
|
150
|
329
|
# $(eval ...), but this function exists only in GNU make >= 3.80.
|
|
@@ -158,7 +337,7 @@ autosrcs :
|
158
|
337
|
#
|
159
|
338
|
define src_template
|
160
|
339
|
|
161
|
|
- @$(ECHO) "Generating Makefile rules for $(1)"
|
|
340
|
+ @$(ECHO) " [DEPS] $(1)"
|
162
|
341
|
@$(MKDIR) -p $(dir $(2))
|
163
|
342
|
@$(RM) $(2)
|
164
|
343
|
@$(TOUCH) $(2)
|
|
@@ -183,13 +362,13 @@ define obj_template
|
183
|
362
|
-Wno-error -MM $(1) -MT "$(4)_DEPS" -MG -MP | \
|
184
|
363
|
sed 's/_DEPS\s*:/_DEPS =/' >> $(2)
|
185
|
364
|
@$(ECHO_E) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
|
186
|
|
- '\n\t$$(QM)$(ECHO) " [BUILD] $$@"\n' \
|
|
365
|
+ '\n\t$$(QM)$(ECHO) " [BUILD] $$@"' \
|
187
|
366
|
'\n\t$$(RULE_$(3))\n' \
|
188
|
367
|
'\nBOBJS += $$(BIN)/$(4).o\n' \
|
189
|
368
|
$(foreach TGT,$(DEBUG_TARGETS), \
|
190
|
369
|
$(if $(RULE_$(3)_to_$(TGT)), \
|
191
|
370
|
'\n$$(BIN)/$(4).$(TGT) : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
|
192
|
|
- '\n\t$$(QM)$(ECHO) " [BUILD] $$@"\n' \
|
|
371
|
+ '\n\t$$(QM)$(ECHO) " [BUILD] $$@"' \
|
193
|
372
|
'\n\t$$(RULE_$(3)_to_$(TGT))\n' \
|
194
|
373
|
'\n$(TGT)_OBJS += $$(BIN)/$(4).$(TGT)\n' ) ) \
|
195
|
374
|
'\n$(2) : $$($(4)_DEPS)\n' \
|
|
@@ -206,7 +385,9 @@ $(BIN)/deps/%.d : % $(MAKEDEPS) $(PARSEROM)
|
206
|
385
|
# Calculate and include the list of Makefile rules files
|
207
|
386
|
#
|
208
|
387
|
AUTO_DEPS = $(patsubst %,$(BIN)/deps/%.d,$(AUTO_SRCS))
|
|
388
|
+ifdef NEED_DEPS
|
209
|
389
|
-include $(AUTO_DEPS)
|
|
390
|
+endif
|
210
|
391
|
autodeps :
|
211
|
392
|
@$(ECHO) $(AUTO_DEPS)
|
212
|
393
|
VERYCLEANUP += $(BIN)/deps
|
|
@@ -238,7 +419,7 @@ $(BIN)/NIC : $(AUTO_DEPS)
|
238
|
419
|
'it is only for rom-o-matic' >> $@
|
239
|
420
|
@$(ECHO) >> $@
|
240
|
421
|
@perl -ne 'chomp; print "$$1\n" if /\# NIC\t(.*)$$/' $^ >> $@
|
241
|
|
-CLEANUP += $(BIN)/NIC
|
|
422
|
+CLEANUP += $(BIN)/NIC # Doesn't match the $(BIN)/*.* pattern
|
242
|
423
|
|
243
|
424
|
# Analyse a target name (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and
|
244
|
425
|
# derive the variables:
|
|
@@ -343,8 +524,13 @@ $(BIN)/%.info :
|
343
|
524
|
# in order to correctly rebuild blib whenever the list of objects
|
344
|
525
|
# changes.
|
345
|
526
|
#
|
346
|
|
-BLIB_LIST = $(BIN)/.blib.list
|
347
|
|
-ifneq ($(shell cat $(BLIB_LIST)),$(BLIB_OBJS))
|
|
527
|
+BLIB_LIST := $(BIN)/.blib.list
|
|
528
|
+ifeq ($(wildcard $(BLIB_LIST)),)
|
|
529
|
+BLIB_LIST_OBJS :=
|
|
530
|
+else
|
|
531
|
+BLIB_LIST_OBJS := $(shell cat $(BLIB_LIST))
|
|
532
|
+endif
|
|
533
|
+ifneq ($(BLIB_LIST_OBJS),$(BLIB_OBJS))
|
348
|
534
|
$(shell $(ECHO) "$(BLIB_OBJS)" > $(BLIB_LIST))
|
349
|
535
|
endif
|
350
|
536
|
|
|
@@ -397,10 +583,6 @@ $(BIN)/%.zbin : $(BIN)/%.bin $(BIN)/%.zinfo $(ZBIN)
|
397
|
583
|
$(QM)$(ECHO) " [ZBIN] $@"
|
398
|
584
|
$(Q)$(ZBIN) $(BIN)/$*.bin $(BIN)/$*.zinfo > $@
|
399
|
585
|
|
400
|
|
-# Build bochs symbol table
|
401
|
|
-$(BIN)/%.bxs : $(BIN)/%.tmp
|
402
|
|
- $(NM) $< | cut -d" " -f1,3 > $@
|
403
|
|
-
|
404
|
586
|
# Rules for each media format. These are generated and placed in an
|
405
|
587
|
# external Makefile fragment. We could do this via $(eval ...), but
|
406
|
588
|
# that would require make >= 3.80.
|
|
@@ -436,7 +618,7 @@ automedia :
|
436
|
618
|
#
|
437
|
619
|
define media_template
|
438
|
620
|
|
439
|
|
- @$(ECHO) "Generating Makefile rules for $(1) media"
|
|
621
|
+ @$(ECHO) " [MEDIADEPS] $(1)"
|
440
|
622
|
@$(MKDIR) -p $(dir $(2))
|
441
|
623
|
@$(RM) $(2)
|
442
|
624
|
@$(TOUCH) $(2)
|
|
@@ -460,7 +642,18 @@ $(BIN)/deps/%.media.d : $(MAKEDEPS)
|
460
|
642
|
MEDIA_DEPS = $(patsubst %,$(BIN)/deps/%.media.d,$(AUTO_MEDIA))
|
461
|
643
|
mediadeps :
|
462
|
644
|
@$(ECHO) $(MEDIA_DEPS)
|
|
645
|
+ifdef NEED_DEPS
|
463
|
646
|
-include $(MEDIA_DEPS)
|
|
647
|
+endif
|
|
648
|
+
|
|
649
|
+# Wrap up binary blobs (for embedded images)
|
|
650
|
+#
|
|
651
|
+$(BIN)/%.o : payload/%.img
|
|
652
|
+ $(QM)echo " [WRAP] $@"
|
|
653
|
+ $(Q)$(LD) -b binary -r -o $@ $< --undefined obj_payload \
|
|
654
|
+ --defsym obj_$*=0
|
|
655
|
+
|
|
656
|
+BOBJS += $(patsubst payload/%.img,$(BIN)/%.o,$(wildcard payload/*.img))
|
464
|
657
|
|
465
|
658
|
# The "allXXXs" targets for each suffix
|
466
|
659
|
#
|
|
@@ -473,15 +666,23 @@ allpxes allisos alldsks : all%s : $(foreach DRIVER,$(DRIVERS),$(BIN)/$(DRIVER).%
|
473
|
666
|
$(BIN)/etherboot.% : $(BIN)/gpxe.%
|
474
|
667
|
ln -sf $(notdir $<) $@
|
475
|
668
|
|
476
|
|
-# Wrap up binary blobs
|
|
669
|
+endif # defined(BIN)
|
|
670
|
+
|
|
671
|
+###############################################################################
|
477
|
672
|
#
|
478
|
|
-$(BIN)/%.o : payload/%.img
|
479
|
|
- $(QM)echo " [WRAP] $@"
|
480
|
|
- $(Q)$(LD) -b binary -r -o $@ $< --undefined obj_payload \
|
481
|
|
- --defsym obj_$*=0
|
|
673
|
+# Rules for finalising files. TGT_MAKEROM_FLAGS is defined as part of
|
|
674
|
+# the automatic build system and varies by target; it includes the
|
|
675
|
+# "-p 0x1234,0x5678" string to set the PCI IDs.
|
|
676
|
+#
|
|
677
|
+FINALISE_rom = $(MAKEROM) $(MAKEROM_FLAGS) $(TGT_MAKEROM_FLAGS) \
|
|
678
|
+ -i$(IDENT) -s 0 $@
|
482
|
679
|
|
483
|
|
-BOBJS += $(patsubst payload/%.img,$(BIN)/%.o,$(wildcard payload/*.img))
|
|
680
|
+# Some ROMs require specific flags to be passed to makerom.pl
|
|
681
|
+#
|
|
682
|
+MAKEROM_FLAGS_3c503 = -3
|
484
|
683
|
|
|
684
|
+###############################################################################
|
|
685
|
+#
|
485
|
686
|
# The compression utilities
|
486
|
687
|
#
|
487
|
688
|
$(NRV2B) : util/nrv2b.c $(MAKEDEPS)
|
|
@@ -495,6 +696,8 @@ $(ZBIN) : util/zbin.c util/nrv2b.c $(MAKEDEPS)
|
495
|
696
|
$(Q)$(HOST_CC) -O2 -o $@ $<
|
496
|
697
|
CLEANUP += $(ZBIN)
|
497
|
698
|
|
|
699
|
+###############################################################################
|
|
700
|
+#
|
498
|
701
|
# Auto-incrementing build serial number. Append "bs" to your list of
|
499
|
702
|
# build targets to get a serial number printed at the end of the
|
500
|
703
|
# build. Enable -DBUILD_SERIAL in order to see it when the code runs.
|
|
@@ -518,27 +721,30 @@ bs : $(BUILDSERIAL_NOW)
|
518
|
721
|
@$(ECHO) $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT)
|
519
|
722
|
@$(ECHO) "Build serial number is $(shell cat $<)"
|
520
|
723
|
|
521
|
|
-# List of available architectures
|
|
724
|
+###############################################################################
|
522
|
725
|
#
|
523
|
|
-ARCHS = $(filter-out CVS,$(patsubst arch/%,%,$(wildcard arch/*)))
|
524
|
|
-archs :
|
525
|
|
- @$(ECHO) $(ARCHS)
|
|
726
|
+# Build the TAGS file(s) for emacs
|
|
727
|
+#
|
|
728
|
+TAGS :
|
|
729
|
+ ctags -e -R -f $@ --exclude=bin
|
526
|
730
|
|
527
|
|
-OTHER_ARCHS = $(filter-out $(ARCH),$(ARCHS))
|
528
|
|
-otherarchs :
|
529
|
|
- @$(ECHO) $(OTHER_ARCHS)
|
|
731
|
+CLEANUP += TAGS
|
530
|
732
|
|
531
|
|
-# Build the TAGS file for emacs
|
|
733
|
+###############################################################################
|
532
|
734
|
#
|
533
|
|
-TAGS : TAGS.$(ARCH)
|
534
|
|
-
|
535
|
|
-TAGS.$(ARCH) :
|
536
|
|
- ctags -e -R -f $@ --exclude=bin \
|
537
|
|
- $(foreach ARCH,$(OTHER_ARCHS),--exclude=arch/$(ARCH))
|
538
|
|
-CLEANUP += TAGS*
|
|
735
|
+# Force rebuild for any given target
|
|
736
|
+#
|
|
737
|
+%.rebuild :
|
|
738
|
+ rm -f $*
|
|
739
|
+ $(Q)$(MAKE) $*
|
539
|
740
|
|
|
741
|
+###############################################################################
|
|
742
|
+#
|
540
|
743
|
# Symbol table checks
|
541
|
744
|
#
|
|
745
|
+
|
|
746
|
+ifdef BIN
|
|
747
|
+
|
542
|
748
|
SYMTAB = $(BIN)/symtab
|
543
|
749
|
$(SYMTAB) : $(BLIB)
|
544
|
750
|
$(OBJDUMP) -w -t $< > $@
|
|
@@ -548,14 +754,27 @@ CLEANUP += $(BIN)/symtab
|
548
|
754
|
symcheck : $(SYMTAB)
|
549
|
755
|
$(SYMCHECK) $<
|
550
|
756
|
|
551
|
|
-# Force rebuild for any given target
|
|
757
|
+endif # defined(BIN)
|
|
758
|
+
|
|
759
|
+###############################################################################
|
552
|
760
|
#
|
553
|
|
-$(BIN)/%.rebuild :
|
554
|
|
- rm -f $(BIN)/$*
|
555
|
|
- $(MAKE) $(MAKEFLAGS) $(BIN)/$*
|
|
761
|
+# Build bochs symbol table
|
|
762
|
+#
|
|
763
|
+
|
|
764
|
+ifdef BIN
|
556
|
765
|
|
|
766
|
+$(BIN)/%.bxs : $(BIN)/%.tmp
|
|
767
|
+ $(NM) $< | cut -d" " -f1,3 > $@
|
|
768
|
+
|
|
769
|
+endif # defined(BIN)
|
|
770
|
+
|
|
771
|
+###############################################################################
|
|
772
|
+#
|
557
|
773
|
# Documentation
|
558
|
774
|
#
|
|
775
|
+
|
|
776
|
+ifdef BIN
|
|
777
|
+
|
559
|
778
|
$(BIN)/doxygen.cfg : doxygen.cfg $(MAKEDEPS)
|
560
|
779
|
$(PERL) -pe 's{\@SRCDIRS\@}{$(SRCDIRS)}; ' \
|
561
|
780
|
-e 's{\@BIN\@}{$(BIN)}; ' \
|
|
@@ -579,6 +798,10 @@ docview :
|
579
|
798
|
$(ECHO) "Documentation index in $(BIN)/doc/html/index.html" ; \
|
580
|
799
|
fi
|
581
|
800
|
|
|
801
|
+endif # defined(BIN)
|
|
802
|
+
|
|
803
|
+###############################################################################
|
|
804
|
+#
|
582
|
805
|
# Clean-up
|
583
|
806
|
#
|
584
|
807
|
clean :
|
|
@@ -586,19 +809,3 @@ clean :
|
586
|
809
|
|
587
|
810
|
veryclean : clean
|
588
|
811
|
$(RM) -r $(VERYCLEANUP)
|
589
|
|
-
|
590
|
|
-# Make clean tarballs for release
|
591
|
|
-
|
592
|
|
-tarball : ../VERSION
|
593
|
|
- ($(ECHO) -n $(VERSION) ''; date -u +'%Y-%m-%d') > ../VERSION
|
594
|
|
- $(RM) -r /tmp/$(USER)/gpxe-$(VERSION)
|
595
|
|
- mkdir -p /tmp/$(USER)/gpxe-$(VERSION)
|
596
|
|
- cp -rP .. /tmp/$(USER)/gpxe-$(VERSION)
|
597
|
|
- ( cd /tmp/$(USER)/gpxe-$(VERSION)/src ; $(MAKE) veryclean ; $(RM) -r bin/deps )
|
598
|
|
- ( cd /tmp/$(USER); tar cf /tmp/$(USER)/gpxe-$(VERSION).tar --exclude ".git*" --exclude "#*" \
|
599
|
|
- --exclude "*~" gpxe-$(VERSION) )
|
600
|
|
- bzip2 -9 < /tmp/$(USER)/gpxe-$(VERSION).tar > /tmp/$(USER)/gpxe-$(VERSION).tar.bz2
|
601
|
|
- gzip -9 < /tmp/$(USER)/gpxe-$(VERSION).tar > /tmp/$(USER)/gpxe-$(VERSION).tar.gz
|
602
|
|
- $(RM) -r /tmp/$(USER)/gpxe-$(VERSION)
|
603
|
|
- $(RM) /tmp/$(USER)/gpxe-$(VERSION).tar
|
604
|
|
- ( cd /tmp/$(USER) ; tar -zxf /tmp/$(USER)/gpxe-$(VERSION).tar.gz )
|