You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile.housekeeping 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. # -*- makefile -*- : Force emacs to use Makefile mode
  2. # This file contains various boring housekeeping functions that would
  3. # otherwise seriously clutter up the main Makefile.
  4. # Objects to be removed by "make clean"
  5. #
  6. CLEANUP := $(BIN)/*.* # *.* to avoid catching the "CVS" directory
  7. # Version number calculations
  8. #
  9. VERSION_MAJOR = 0
  10. VERSION_MINOR = 5
  11. VERSION_PATCH = 1
  12. EXTRAVERSION =
  13. MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
  14. VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
  15. CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) \
  16. -DVERSION_MINOR=$(VERSION_MINOR) \
  17. -DVERSION=\"$(VERSION)\"
  18. IDENT = '$(@F) $(VERSION) (GPL) etherboot.org'
  19. version :
  20. @echo $(VERSION)
  21. # Check for tools that can cause failed builds
  22. #
  23. .toolcheck : Makefile Config
  24. @if $(CC) -v 2>&1 | grep -is 'gcc version 2\.96' > /dev/null; then \
  25. echo 'gcc 2.96 is unsuitable for compiling Etherboot'; \
  26. echo 'Use gcc 2.95 or gcc 3.x instead'; \
  27. exit 1; \
  28. fi
  29. @if [ `perl -e 'use bytes; print chr(255)' | wc -c` = 2 ]; then \
  30. echo 'Your Perl version has a Unicode handling bug'; \
  31. echo 'Execute this command before compiling Etherboot:'; \
  32. echo 'export LANG=$${LANG%.UTF-8}'; \
  33. exit 1; \
  34. fi
  35. @$(TOUCH) $@
  36. VERYCLEANUP += .toolcheck
  37. # Check for correct syntax for echo -e
  38. #
  39. ifeq ($(shell echo '\0101'),A)
  40. ECHO_E = echo
  41. else
  42. ECHO_E = echo -e
  43. endif
  44. # Build verbosity
  45. #
  46. ifeq ($(V),1)
  47. Q =
  48. QM = @\#
  49. else
  50. Q = @
  51. QM = @
  52. endif
  53. # Check for an old version of gas (binutils 2.9.1)
  54. #
  55. OLDGAS := $(shell $(AS) --version | grep -q '2\.9\.1' && echo -DGAS291)
  56. CFLAGS += $(OLDGAS)
  57. oldgas :
  58. @echo $(oldgas)
  59. # compiler.h is needed for our linking and debugging system
  60. #
  61. CFLAGS += -include compiler.h
  62. # config/%.h files are generated from config.h using mkconfig.pl
  63. config/%.h : config.h
  64. $(MKCONFIG) $<
  65. CLEANUP += config/*.h
  66. # SRCDIRS lists all directories containing source files.
  67. srcdirs :
  68. @echo $(SRCDIRS)
  69. # SRCS lists all .c or .S files found in any SRCDIR
  70. #
  71. SRCS += $(wildcard $(patsubst %,%/*.c,$(SRCDIRS)))
  72. SRCS += $(wildcard $(patsubst %,%/*.S,$(SRCDIRS)))
  73. srcs :
  74. @echo $(SRCS)
  75. # AUTO_SRCS lists all files in SRCS that are not mentioned in
  76. # NON_AUTO_SRCS. Files should be added to NON_AUTO_SRCS if they
  77. # cannot be built using the standard build template.
  78. #
  79. AUTO_SRCS = $(filter-out $(NON_AUTO_SRCS),$(SRCS))
  80. autosrcs :
  81. @echo $(AUTO_SRCS)
  82. # We automatically generate rules for any file mentioned in AUTO_SRCS
  83. # using the following set of templates. It would be cleaner to use
  84. # $(eval ...), but this function exists only in GNU make >= 3.80.
  85. # src_template : generate Makefile rules for a given source file
  86. #
  87. # $(1) is the full path to the source file (e.g. "drivers/net/rtl8139.c")
  88. # $(2) is the full path to the .d file (e.g. "bin/deps/drivers/net/rtl8139.d")
  89. # $(3) is the source type (e.g. "c")
  90. # $(4) is the source base name (e.g. "rtl8139")
  91. #
  92. define src_template
  93. @echo "Generating Makefile rules for $(1)"
  94. @$(MKDIR) -p $(dir $(2))
  95. @$(RM) $(2)
  96. @$(TOUCH) $(2)
  97. $(foreach OBJ,$(if $(OBJS_$(4)),$(OBJS_$(4)),$(4)), \
  98. $(call obj_template,$(1),$(2),$(3),$(OBJ)))
  99. @$(PARSEROM) $(1) >> $(2)
  100. endef
  101. # obj_template : generate Makefile rules for a given resultant object
  102. # of a particular source file. (We can have multiple objects per
  103. # source file via the OBJS_xxx list.)
  104. #
  105. # $(1) is the full path to the source file (e.g. "drivers/net/rtl8139.c")
  106. # $(2) is the full path to the .d file (e.g. "bin/deps/drivers/net/rtl8139.d")
  107. # $(3) is the source type (e.g. "c")
  108. # $(4) is the object name (e.g. "rtl8139")
  109. #
  110. define obj_template
  111. @$(CPP) $(CFLAGS) $(CFLAGS_$(3)) $(CFLAGS_$(4)) -DOBJECT=$(4) \
  112. -Wno-error -M $(1) -MT "$(4)_DEPS" -MG -MP | \
  113. sed 's/_DEPS\s*:/_DEPS =/' >> $(2)
  114. @$(ECHO_E) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
  115. '\n\t$$(QM)echo " [BUILD] $$@"\n' \
  116. '\n\t$$(RULE_$(3))\n' \
  117. '\nBOBJS += $$(BIN)/$(4).o\n' \
  118. $(foreach TGT,$(DEBUG_TARGETS), \
  119. $(if $(RULE_$(3)_to_$(TGT)), \
  120. '\n$$(BIN)/$(4).$(TGT) : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
  121. '\n\t$$(QM)echo " [BUILD] $$@"\n' \
  122. '\n\t$$(RULE_$(3)_to_$(TGT))\n' \
  123. '\n$(TGT)_OBJS += $$(BIN)/$(4).$(TGT)\n' ) ) \
  124. '\n$(2) : $$($(4)_DEPS)\n' \
  125. '\nTAGS : $$($(4)_DEPS)\n' \
  126. >> $(2)
  127. endef
  128. # Rule to generate the Makefile rules files to be included
  129. #
  130. $(BIN)/deps/%.d : % $(MAKEDEPS) $(PARSEROM)
  131. $(if $(filter $(AUTO_SRCS),$<),$(call src_template,$<,$@,$(subst .,,$(suffix $<)),$(basename $(notdir $<))),@echo 'ERROR: $< is not an AUTO_SRC' ; exit 1)
  132. # Calculate and include the list of Makefile rules files
  133. #
  134. AUTO_DEPS = $(patsubst %,$(BIN)/deps/%.d,$(AUTO_SRCS))
  135. include $(AUTO_DEPS)
  136. autodeps :
  137. @echo $(AUTO_DEPS)
  138. VERYCLEANUP += $(BIN)/deps
  139. # The following variables are created by the Makefile rules files
  140. #
  141. bobjs :
  142. @echo $(BOBJS)
  143. drivers :
  144. @echo $(DRIVERS)
  145. .PHONY : drivers
  146. roms :
  147. @echo $(ROMS)
  148. # Generate the NIC file from the parsed source files. The NIC file is
  149. # only for rom-o-matic.
  150. #
  151. $(BIN)/NIC : $(AUTO_DEPS)
  152. @echo '# This is an automatically generated file, do not edit' > $@
  153. @echo '# It does not affect anything in the build, ' \
  154. 'it is only for rom-o-matic' >> $@
  155. @echo >> $@
  156. @perl -ne 'chomp; print "$$1\n" if /\# NIC\t(.*)$$/' $^ >> $@
  157. CLEANUP += $(BIN)/NIC
  158. # Analyse a target name (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and
  159. # derive the variables:
  160. #
  161. # TGT_ELEMENTS : the elements of the target (e.g. "dfe538 prism2_pci")
  162. # TGT_PREFIX : the prefix type (e.g. "zrom")
  163. # TGT_DRIVERS : the driver for each element (e.g. "rtl8139 prism2_pci")
  164. # TGT_ROM_NAME : the ROM name (e.g. "dfe538")
  165. # TGT_MEDIA : the media type (e.g. "rom")
  166. #
  167. DRIVERS_gpxe = $(DRIVERS)
  168. CARD_DRIVER = $(firstword $(DRIVER_$(1)) $(1))
  169. TGT_ELEMENTS = $(subst --, ,$(firstword $(subst ., ,$(notdir $@))))
  170. TGT_PREFIX = $(word 2,$(subst ., ,$(notdir $@)))
  171. TGT_ROM_NAME = $(firstword $(TGT_ELEMENTS))
  172. TGT_DRIVERS = $(strip $(if $(DRIVERS_$(TGT_ROM_NAME)), \
  173. $(DRIVERS_$(TGT_ROM_NAME)), \
  174. $(foreach TGT_ELEMENT,$(TGT_ELEMENTS), \
  175. $(call CARD_DRIVER,$(TGT_ELEMENT))) ))
  176. TGT_MEDIA = $(subst z,,$(TGT_PREFIX))
  177. # Look up ROM IDs for the current target
  178. # (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the variables:
  179. #
  180. # TGT_PCI_VENDOR : the PCI vendor ID (e.g. "0x1186")
  181. # TGT_PCI_DEVICE : the PCI device ID (e.g. "0x1300")
  182. #
  183. TGT_PCI_VENDOR = $(PCI_VENDOR_$(TGT_ROM_NAME))
  184. TGT_PCI_DEVICE = $(PCI_DEVICE_$(TGT_ROM_NAME))
  185. # Calculate link-time options for the current target
  186. # (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the variables:
  187. #
  188. # TGT_LD_DRIVERS : symbols to require in order to drag in the relevant drivers
  189. # (e.g. "obj_rtl8139 obj_prism2_pci")
  190. # TGT_LD_IDS : symbols to define in order to fill in ID structures in the
  191. # ROM header (e.g."pci_vendor_id=0x1186 pci_device_id=0x1300")
  192. #
  193. TGT_LD_DRIVERS = $(subst -,_,$(patsubst %,obj_%,$(TGT_DRIVERS)))
  194. TGT_LD_PREFIX = obj_$(TGT_PREFIX)prefix
  195. TGT_LD_IDS = $(if $(TGT_PCI_VENDOR),pci_vendor_id=$(TGT_PCI_VENDOR)) \
  196. $(if $(TGT_PCI_DEVICE),pci_device_id=$(TGT_PCI_DEVICE))
  197. # Calculate linker flags based on link-time options for the current
  198. # target type (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the
  199. # variables:
  200. #
  201. # TGT_LD_FLAGS : target-specific flags to pass to linker (e.g.
  202. # "-u obj_zpciprefix -u obj_rtl8139 -u obj_prism2_pci
  203. # --defsym pci_vendor=0x1186 --defsym pci_device=0x1300")
  204. #
  205. TGT_LD_FLAGS = $(foreach SYM,$(TGT_LD_PREFIX) $(TGT_LD_DRIVERS) obj_config,\
  206. -u $(SYM) --defsym check_$(SYM)=$(SYM) ) \
  207. $(patsubst %,--defsym %,$(TGT_LD_IDS))
  208. # Calculate makerom flags for the specific target
  209. # (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the variables:
  210. #
  211. # TGT_MAKEROM_FLAGS : target-specific flags for makerom (e.g.
  212. # "-p 0x1186,0x1300")
  213. #
  214. TGT_MAKEROM_FLAGS = $(strip $(MAKEROM_FLAGS_$(TGT_ROM_NAME)) \
  215. $(if $(TGT_PCI_VENDOR),$(strip -p $(TGT_PCI_VENDOR),$(TGT_PCI_DEVICE))))
  216. # Calculate list of debugging versions of objects to be included in
  217. # the target.
  218. #
  219. COMMA := ,
  220. DEBUG_LIST = $(subst $(COMMA), ,$(DEBUG))
  221. DEBUG_OBJ_LEVEL = $(firstword $(word 2,$(subst :, ,$(1))) 1)
  222. DEBUG_OBJ_BASE = $(word 1,$(subst :, ,$(1))).dbg$(call DEBUG_OBJ_LEVEL,$(1))
  223. DEBUG_OBJ = $(BIN)/$(call DEBUG_OBJ_BASE,$(1)).o
  224. DEBUG_ORIG_OBJ = $(BIN)/$(word 1,$(subst :, ,$(1))).o
  225. DEBUG_OBJS = $(foreach D,$(DEBUG_LIST),$(call DEBUG_OBJ,$(D)))
  226. DEBUG_ORIG_OBJS = $(foreach D,$(DEBUG_LIST),$(call DEBUG_ORIG_OBJ,$(D)))
  227. BLIB_OBJS = $(DEBUG_OBJS) $(filter-out $(DEBUG_ORIG_OBJS),$(BOBJS))
  228. # Print out all derived information for a given target.
  229. #
  230. $(BIN)/%.info :
  231. @echo 'Elements : $(TGT_ELEMENTS)'
  232. @echo 'Prefix : $(TGT_PREFIX)'
  233. @echo 'Drivers : $(TGT_DRIVERS)'
  234. @echo 'ROM name : $(TGT_ROM_NAME)'
  235. @echo 'Media : $(TGT_MEDIA)'
  236. @echo
  237. @echo 'PCI vendor : $(TGT_PCI_VENDOR)'
  238. @echo 'PCI device : $(TGT_PCI_DEVICE)'
  239. @echo
  240. @echo 'LD driver symbols : $(TGT_LD_DRIVERS)'
  241. @echo 'LD prefix symbols : $(TGT_LD_PREFIX)'
  242. @echo 'LD ID symbols : $(TGT_LD_IDS)'
  243. @echo
  244. @echo 'LD target flags : $(TGT_LD_FLAGS)'
  245. @echo
  246. @echo 'makerom target flags : $(TGT_MAKEROM_FLAGS)'
  247. @echo
  248. @echo 'Debugging objects : $(DEBUG_OBJS)'
  249. @echo 'Replaced objects : $(DEBUG_ORIG_OBJS)'
  250. # List of objects included in the last build of blib. This is needed
  251. # in order to correctly rebuild blib whenever the list of objects
  252. # changes.
  253. #
  254. BLIB_LIST = $(BIN)/.blib.list
  255. ifneq ($(shell cat $(BLIB_LIST)),$(BLIB_OBJS))
  256. $(shell echo "$(BLIB_OBJS)" > $(BLIB_LIST))
  257. endif
  258. $(BLIB_LIST) :
  259. VERYCLEANUP += $(BLIB_LIST)
  260. # Library of all objects
  261. #
  262. BLIB = $(BIN)/blib.a
  263. $(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
  264. $(Q)$(RM) $(BLIB)
  265. $(QM)echo " [AR] $@"
  266. $(Q)$(AR) r $@ $(BLIB_OBJS)
  267. $(Q)$(RANLIB) $@
  268. blib : $(BLIB)
  269. # Build an intermediate object file from the objects required for the
  270. # specified target.
  271. #
  272. $(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
  273. $(QM)echo " [LD] $@"
  274. $(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $(BLIB) -o $@ \
  275. -Map $(BIN)/$*.tmp.map
  276. $(Q)$(OBJDUMP) -ht $@ | $(SORTOBJDUMP) >> $(BIN)/$*.tmp.map
  277. # Show a linker map for the specified target
  278. #
  279. $(BIN)/%.map : $(BIN)/%.tmp
  280. @less $(BIN)/$*.tmp.map
  281. # Extract compression information from intermediate object file
  282. #
  283. $(BIN)/%.zinfo : $(BIN)/%.tmp
  284. $(QM)echo " [ZINFO] $@"
  285. $(Q)$(OBJCOPY) -O binary -j .zinfo $< $@
  286. # Build raw binary file from intermediate object file
  287. #
  288. $(BIN)/%.bin : $(BIN)/%.tmp
  289. $(QM)echo " [BIN] $@"
  290. $(Q)$(OBJCOPY) -O binary -R .zinfo $< $@
  291. # Compress raw binary file
  292. #
  293. $(BIN)/%.zbin : $(BIN)/%.bin $(BIN)/%.zinfo $(ZBIN)
  294. $(QM)echo " [ZBIN] $@"
  295. $(Q)$(ZBIN) $(BIN)/$*.bin $(BIN)/$*.zinfo > $@
  296. # Build bochs symbol table
  297. $(BIN)/%.bxs : $(BIN)/%.tmp
  298. $(NM) $< | cut -d" " -f1,3 > $@
  299. # Rules for each media format. These are generated and placed in an
  300. # external Makefile fragment. We could do this via $(eval ...), but
  301. # that would require make >= 3.80.
  302. #
  303. # Note that there's an alternative way to generate most .rom images:
  304. # they can be copied from their 'master' ROM image using cp and
  305. # reprocessed with makerom to add the PCI IDs and ident string. The
  306. # relevant rule would look something like:
  307. #
  308. # $(BIN)/dfe538%rom : $(BIN)/rtl8139%rom
  309. # cat $< $@
  310. # $(FINALISE_rom)
  311. #
  312. # You can derive the ROM/driver relationships using the variables
  313. # DRIVER_<rom> and/or ROMS_<driver>.
  314. #
  315. # We don't currently do this, because (a) it would require generating
  316. # yet more Makefile fragments (since you need a rule for each ROM in
  317. # ROMS), and (b) the linker is so fast that it probably wouldn't make
  318. # much difference to the overall build time.
  319. media :
  320. @echo $(MEDIA)
  321. AUTO_MEDIA = $(filter-out $(NON_AUTO_MEDIA),$(MEDIA))
  322. automedia :
  323. @echo $(AUTO_MEDIA)
  324. # media_template : create Makefile rules for specified media
  325. #
  326. # $(1) is the media name (e.g. "rom")
  327. # $(2) is the full path to the .d file (e.g. "bin/deps/rom.media.d")
  328. #
  329. define media_template
  330. @echo "Generating Makefile rules for $(1) media"
  331. @$(MKDIR) -p $(dir $(2))
  332. @$(RM) $(2)
  333. @$(TOUCH) $(2)
  334. @$(ECHO_E) '$$(BIN)/%$(1) : $$(BIN)/%$(1).zbin' \
  335. '\n\t$$(QM)echo " [FINISH] $$@"' \
  336. '\n\t$$(Q)$$(CP) $$< $$@' \
  337. '\n\t$$(Q)$$(FINALISE_$(1))' \
  338. > $(2)
  339. endef
  340. # Rule to generate the Makefile rules to be included
  341. #
  342. $(BIN)/deps/%.media.d : $(MAKEDEPS)
  343. $(if $(filter $(AUTO_MEDIA),$*), \
  344. $(call media_template,$*,$@), \
  345. @echo 'ERROR: $* is not an AUTO_MEDIA' ; exit 1)
  346. # Calculate and include the list of Makefile rules files
  347. #
  348. MEDIA_DEPS = $(patsubst %,$(BIN)/deps/%.media.d,$(AUTO_MEDIA))
  349. mediadeps :
  350. @echo $(MEDIA_DEPS)
  351. include $(MEDIA_DEPS)
  352. # The "allXXXs" targets for each suffix
  353. #
  354. allroms allzroms : all%s : $(foreach ROM,$(ROMS),$(BIN)/$(ROM).%)
  355. all%s : $(foreach DRIVER,$(DRIVERS),$(BIN)/$(DRIVER).%)
  356. # The compression utilities
  357. #
  358. $(NRV2B) : util/nrv2b.c $(MAKEDEPS)
  359. $(QM)echo " [HOSTCC] $@"
  360. $(Q)$(HOST_CC) -O2 -DENCODE -DDECODE -DMAIN -DVERBOSE -DNDEBUG \
  361. -DBITSIZE=32 -DENDIAN=0 -o $@ $<
  362. CLEANUP += $(NRV2B)
  363. $(ZBIN) : util/zbin.c util/nrv2b.c $(MAKEDEPS)
  364. $(QM)echo " [HOSTCC] $@"
  365. $(Q)$(HOST_CC) -O2 -o $@ $<
  366. CLEANUP += $(ZBIN)
  367. # Auto-incrementing build serial number. Append "bs" to your list of
  368. # build targets to get a serial number printed at the end of the
  369. # build. Enable -DBUILD_SERIAL in order to see it when the code runs.
  370. #
  371. BUILDSERIAL_H = config/.buildserial.h
  372. BUILDSERIAL_NOW = config/.buildserial.now
  373. BUILDSERIAL_NEXT = config/.buildserial.next
  374. $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) :
  375. echo 1 > $@
  376. $(BUILDSERIAL_H) : $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT)
  377. echo '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@
  378. ifeq ($(filter bs,$(MAKECMDGOALS)),bs)
  379. $(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \
  380. cp -f $(BUILDSERIAL_NEXT) $(BUILDSERIAL_NOW))
  381. endif
  382. bs : $(BUILDSERIAL_NOW)
  383. @echo $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT)
  384. @echo "Build serial number is $(shell cat $<)"
  385. # List of available architectures
  386. #
  387. ARCHS = $(filter-out CVS,$(patsubst arch/%,%,$(wildcard arch/*)))
  388. archs :
  389. @echo $(ARCHS)
  390. OTHER_ARCHS = $(filter-out $(ARCH),$(ARCHS))
  391. otherarchs :
  392. @echo $(OTHER_ARCHS)
  393. # Build the TAGS file for emacs
  394. #
  395. TAGS : TAGS.$(ARCH)
  396. TAGS.$(ARCH) :
  397. ctags -e -R -f $@ --exclude=bin \
  398. $(foreach ARCH,$(OTHER_ARCHS),--exclude=arch/$(ARCH))
  399. CLEANUP += TAGS*
  400. # Symbol table checks
  401. #
  402. SYMTAB = $(BIN)/symtab
  403. $(SYMTAB) : $(BLIB)
  404. $(OBJDUMP) -w -t $< > $@
  405. CLEANUP += $(BIN)/symtab
  406. symcheck : $(SYMTAB)
  407. $(SYMCHECK) $<
  408. # Force rebuild for any given target
  409. #
  410. $(BIN)/%.rebuild :
  411. rm -f $(BIN)/$*
  412. $(MAKE) $(MAKEFLAGS) $(BIN)/$*
  413. # Documentation
  414. #
  415. $(BIN)/doxygen.cfg : doxygen.cfg $(MAKEDEPS)
  416. $(PERL) -pe 's{\@SRCDIRS\@}{$(SRCDIRS)}; ' \
  417. -e 's{\@BIN\@}{$(BIN)}; ' \
  418. -e 's{\@ARCH\@}{$(ARCH)}; ' \
  419. $< > $@
  420. $(BIN)/doc : $(BIN)/doxygen.cfg
  421. $(DOXYGEN) $<
  422. .PHONY : $(BIN)/doc
  423. VERYCLEANUP += $(BIN)/doc
  424. doc : $(BIN)/doc
  425. docview :
  426. @[ -f $(BIN)/doc/html/index.html ] || $(MAKE) $(BIN)/doc
  427. @if [ -n "$$BROWSER" ] ; then \
  428. ( $$BROWSER $(BIN)/doc/html/index.html & ) ; \
  429. else \
  430. echo "Documentation index in $(BIN)/doc/html/index.html" ; \
  431. fi
  432. # Clean-up
  433. #
  434. clean :
  435. $(RM) $(CLEANUP)
  436. veryclean : clean
  437. $(RM) -r $(VERYCLEANUP)
  438. # Make clean tarballs for release
  439. gpxe-tarball : ../VERSION
  440. (echo -n $(VERSION) ''; date -u +'%Y-%m-%d') > ../VERSION
  441. $(RM) -r /tmp/gpxe/gpxe-$(VERSION)
  442. mkdir -p /tmp/gpxe/gpxe-$(VERSION)
  443. cp -rP .. /tmp/gpxe/gpxe-$(VERSION)
  444. $(RM) -r /tmp/gpxe/CVS
  445. ( cd /tmp/gpxe/gpxe-$(VERSION)/src ; $(RM) -r bin/deps ; $(MAKE) clean ; $(MAKE) veryclean )
  446. ( cd /tmp/gpxe; tar cf /tmp/gpxe/gpxe-$(VERSION).tar --exclude CVS --exclude "#*" \
  447. --exclude "*~" gpxe-$(VERSION) )
  448. bzip2 -9 < /tmp/gpxe/gpxe-$(VERSION).tar > /tmp/gpxe/gpxe-$(VERSION).tar.bz2
  449. gzip -9 < /tmp/gpxe/gpxe-$(VERSION).tar > /tmp/gpxe/gpxe-$(VERSION).tar.gz
  450. $(RM) -r /tmp/gpxe/gpxe-$(VERSION)
  451. $(RM) /tmp/gpxe/gpxe-$(VERSION).tar
  452. ( cd /tmp/gpxe ; tar -zxf /tmp/gpxe/gpxe-$(VERSION).tar.gz )