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.main 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. #
  2. # Makefile for Etherboot
  3. #
  4. # Most of the time you should edit Config
  5. #
  6. # Common options:
  7. # VERSION_*=v - Set the major and minor version numbers
  8. #
  9. # NS8390 options:
  10. # -DINCLUDE_NE - Include NE1000/NE2000 support
  11. # -DNE_SCAN=list - Probe for NE base address using list of
  12. # comma separated hex addresses
  13. # -DINCLUDE_3C503 - Include 3c503 support
  14. # -DT503_SHMEM - Use 3c503 shared memory mode (off by default)
  15. # -DINCLUDE_WD - Include Western Digital/SMC support
  16. # -DWD_DEFAULT_MEM- Default memory location for WD/SMC cards
  17. # -DWD_790_PIO - Read/write to WD/SMC 790 cards in PIO mode (default
  18. # is to use shared memory) Try this if you get "Bogus
  19. # packet, ignoring" messages, common on ISA/PCI hybrid
  20. # systems.
  21. # -DCOMPEX_RL2000_FIX
  22. #
  23. # If you have a Compex RL2000 PCI 32-bit (11F6:1401),
  24. # and the bootrom hangs in "Probing...[NE*000/PCI]",
  25. # try enabling this fix... it worked for me :).
  26. # In the first packet write somehow it somehow doesn't
  27. # get back the expected data so it is stuck in a loop.
  28. # I didn't bother to investigate what or why because it works
  29. # when I interrupt the loop if it takes more then COMPEX_RL2000_TRIES.
  30. # The code will notify if it does a abort.
  31. # SomniOne - somnione@gmx.net
  32. #
  33. # 3C509 option:
  34. # -DINCLUDE_3C509 - Include 3c509 support
  35. #
  36. # 3C90X options:
  37. # -DINCLUDE_3C90X - Include 3c90x support
  38. #
  39. # Warning Warning Warning
  40. # If you use any of the XCVR options below, please do not complain about
  41. # the behaviour with Linux drivers to the kernel developers. You are
  42. # on your own if you do this. Please read 3c90x.txt to understand
  43. # what they do. If you don't understand them, ask for help on the
  44. # Etherboot mailing list. And please document what you did to the NIC
  45. # on the NIC so that people after you won't get nasty surprises.
  46. #
  47. # -DCFG_3C90X_PRESERVE_XCVR - Reset the transceiver type to the value it
  48. # had initially just before the loaded code is started.
  49. # -DCFG_3C90X_XCVR - Hardcode the tranceiver type Etherboot uses.
  50. # -DCFG_3C90X_BOOTROM_FIX - If you have a 3c905B with buggy ROM
  51. # interface, setting this option might "fix" it. Use
  52. # with caution and read the docs in 3c90x.txt!
  53. #
  54. # See the documentation file 3c90x.txt for more details.
  55. #
  56. # CS89X0 (optional) options:
  57. # -DINCLUDE_CS89X0- Include CS89x0 support
  58. # -DCS_SCAN=list - Probe for CS89x0 base address using list of
  59. # comma separated hex addresses; increasing the
  60. # address by one (0x300 -> 0x301) will force a
  61. # more aggressive probing algorithm. This might
  62. # be neccessary after a soft-reset of the NIC.
  63. #
  64. # LANCE options:
  65. # -DINCLUDE_NE2100- Include NE2100 support
  66. # -DINCLUDE_NI6510- Include NI6510 support
  67. #
  68. # SK_G16 options:
  69. # -DINCLUDE_SK_G16- Include SK_G16 support
  70. #
  71. # I82586 options:
  72. # -DINCLUDE_3C507 - Include 3c507 support
  73. # -DINCLUDE_NI5210- Include NI5210 support
  74. # -DINCLUDE_EXOS205-Include EXOS205 support
  75. #
  76. # SMC9000 options:
  77. # -DINCLUDE_SMC9000 - Include SMC9000 driver
  78. # -DSMC9000_SCAN=list - List of I/O addresses to probe
  79. #
  80. # TIARA (Fujitsu Etherstar) options:
  81. # -DINCLUDE_TIARA - Include Tiara support
  82. #
  83. # NI5010 options:
  84. # -DINCLUDE_NI5010 - Include NI5010 support
  85. #
  86. # TULIP options:
  87. # -DINCLUDE_TULIP - Include Tulip support
  88. #
  89. # RTL8139 options:
  90. # -DINCLUDE_RTL8139 - Include RTL8139 support
  91. #
  92. # SIS900 options:
  93. # -DINCLUDE_SIS900 - Include SIS900 support
  94. #
  95. # NATSEMI options:
  96. # -DINCLUDE_NATSEMI - Include NATSEMI support
  97. #
  98. SRCS:=
  99. BOBJS:=
  100. MAKEROM= $(PERL) ./util/makerom.pl
  101. VERSION_MAJOR= 5
  102. VERSION_MINOR= 3
  103. VERSION_PATCH= 14
  104. EXTRAVERSION=
  105. VERSION= $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)$(EXTRAVERSION)
  106. MM_VERSION= $(VERSION_MAJOR).$(VERSION_MINOR)
  107. CFLAGS+= -DVERSION_MAJOR=$(VERSION_MAJOR) \
  108. -DVERSION_MINOR=$(VERSION_MINOR) \
  109. -DVERSION=\"$(VERSION)\" $(OLDGAS) \
  110. -I include -I arch/$(ARCH)/include \
  111. -DARCH=$(ARCH)
  112. FILO=filo
  113. FILO_PROGRAM_NAME = FILO
  114. FILO_PROGRAM_VERSION = 0.4.1
  115. FILO_BUILD_INFO = ($(shell whoami)@$(shell hostname)) $(shell LANG=C date)
  116. GCCINCDIR = $(shell $(CC) -print-search-dirs | head -n 1 | cut -d' ' -f2)include
  117. CPPFLAGS = -nostdinc -imacros filo/config.h
  118. #-Ifilo/include -I$(GCCINCDIR) -MD
  119. ASFLAGS_X = -D__ASSEMBLY__
  120. IDENT= '$(@F) $(VERSION) (GPL) etherboot.org'
  121. # Find out if we're using binutils 2.9.1 which uses a different syntax in some
  122. # places (most prominently in the opcode prefix area).
  123. OLDGAS:= $(shell $(AS) --version | grep -q '2\.9\.1' && echo -DGAS291)
  124. BUILD_LIBS= $(BLIB)
  125. BUILD_IMGS= $(IMGS)
  126. 3C503FLAGS= -DINCLUDE_3C503 # -DT503_SHMEM
  127. # Note that the suffix to MAKEROM_ is the (mixed case) basename of the ROM file
  128. MAKEROM_3c503= -3
  129. 3C507FLAGS= -DINCLUDE_3C507
  130. 3C509FLAGS= -DINCLUDE_3C509
  131. 3C529FLAGS= -DINCLUDE_3C529
  132. 3C595FLAGS= -DINCLUDE_3C595
  133. 3C90XFLAGS= -DINCLUDE_3C90X
  134. CS89X0FLAGS= -DINCLUDE_CS89X0
  135. EEPROFLAGS= -DINCLUDE_EEPRO
  136. EEPRO100FLAGS= -DINCLUDE_EEPRO100
  137. E1000FLAGS= -DINCLUDE_E1000
  138. EPIC100FLAGS= -DINCLUDE_EPIC100
  139. EXOS205FLAGS= -DINCLUDE_EXOS205
  140. LANCEFLAGS= -DINCLUDE_LANCE # Lance/PCI!
  141. NE2100FLAGS= -DINCLUDE_NE2100
  142. NEFLAGS= -DINCLUDE_NE -DNE_SCAN=0x300,0x280,0x320,0x340,0x380
  143. NS8390FLAGS= -DINCLUDE_NS8390 # NE2000/PCI!
  144. NI5010FLAGS= -DINCLUDE_NI5010
  145. NI5210FLAGS= -DINCLUDE_NI5210
  146. NI6510FLAGS= -DINCLUDE_NI6510
  147. RTL8139FLAGS= -DINCLUDE_RTL8139
  148. SK_G16FLAGS= -DINCLUDE_SK_G16
  149. SIS900FLAGS= -DINCLUDE_SIS900
  150. NATSEMIFLAGS= -DINCLUDE_NATSEMI
  151. SMC9000FLAGS= -DINCLUDE_SMC9000
  152. SUNDANCEFLAGS= -DINCLUDE_SUNDANCE
  153. TLANFLAGS= -DINCLUDE_TLAN
  154. TIARAFLAGS= -DINCLUDE_TIARA
  155. DEPCAFLAGS= -DINCLUDE_DEPCA # -DDEPCA_MODEL=DEPCA -DDEPCA_RAM_BASE=0xd0000
  156. TULIPFLAGS= -DINCLUDE_TULIP
  157. OTULIPFLAGS= -DINCLUDE_OTULIP
  158. VIA_RHINEFLAGS= -DINCLUDE_VIA_RHINE
  159. WDFLAGS= -DINCLUDE_WD -DWD_DEFAULT_MEM=0xCC000
  160. W89C840FLAGS= -DINCLUDE_W89C840
  161. SRCS+= core/serial.c
  162. SRCS+= core/btext.c core/pc_kbd.c
  163. SRCS+= core/main.c core/pci.c core/osloader.c core/nfs.c
  164. SRCS+= core/misc.c core/config.c core/isa_probe.c core/pci_probe.c
  165. SRCS+= core/relocate.c core/heap.c
  166. SRCS+= drivers/disk/floppy.c core/nic.c core/disk.c core/timer.c
  167. SRCS+= core/proto_eth_slow.c
  168. SRCS+= core/proto_slam.c core/proto_tftm.c core/proto_http.c
  169. SRCS+= core/isapnp.c
  170. SRCS+= core/pcmcia.c core/i82365.c
  171. SRCS+= core/pxe_export.c core/dns_resolver.c
  172. FILO_SRCS+= $(FILO)/drivers/ide_x.c
  173. FILO_SRCS+= $(FILO)/fs/blockdev.c $(FILO)/fs/eltorito.c $(FILO)/fs/fsys_ext2fs.c $(FILO)/fs/fsys_fat.c $(FILO)/fs/fsys_iso9660.c
  174. FILO_SRCS+= $(FILO)/fs/fsys_reiserfs.c $(FILO)/fs/vfs.c $(FILO)/fs/fsys_jfs.c $(FILO)/fs/fsys_minix.c $(FILO)/fs/fsys_xfs.c
  175. FILO_SRCS+= $(FILO)/main/elfload.c $(FILO)/main/elfnote.c $(FILO)/main/filo_x.c $(FILO)/main/lib.c $(FILO)/main/linuxbios_x.c
  176. FILO_SRCS+= $(FILO)/main/pci_x.c $(FILO)/main/malloc_x.c $(FILO)/main/printf_x.c $(FILO)/main/console_x.c
  177. FILO_SRCS+= $(FILO)/$(ARCH)/context.c $(FILO)/$(ARCH)/linux_load.c $(FILO)/$(ARCH)/segment.c $(FILO)/$(ARCH)/sys_info.c
  178. FILO_SRCS+= $(FILO)/$(ARCH)/switch.S $(FILO)/usb/debug_x.c $(FILO)/usb/scsi_cmds.c $(FILO)/usb/uhci.c $(FILO)/usb/usb.c
  179. FILO_SRCS+= $(FILO)/usb/ohci.c $(FILO)/usb/usb_scsi_low.c $(FILO)/usb/usb_x.c
  180. BOBJS+= $(BIN)/main.o $(BIN)/osloader.o $(BIN)/nfs.o $(BIN)/misc.o
  181. BOBJS+= $(BIN)/proto_slam.o $(BIN)/proto_tftm.o $(BIN)/proto_http.o
  182. BOBJS+= $(BIN)/floppy.o
  183. BOBJS+= $(BIN)/serial.o $(BIN)/timer.o $(BIN)/relocate.o $(BIN)/heap.o
  184. BOBJS+= $(BIN)/btext.o $(BIN)/pc_kbd.o
  185. BOBJS+= $(BIN)/nic.o $(BIN)/disk.o
  186. BOBJS+= $(BIN)/isapnp.o
  187. BOBJS+= $(BIN)/pci.o $(BIN)/isa_probe.o $(BIN)/pci_probe.o
  188. BOBJS+= $(BIN)/vsprintf.o $(BIN)/string.o
  189. BOBJS+= $(BIN)/pcmcia.o $(BIN)/i82365.o
  190. BOBJS+= $(BIN)/pxe_export.o $(BIN)/dns_resolver.o
  191. FILO_OBJS+= $(BIN)/ide_x.o $(BIN)/pci_x.o
  192. FILO_OBJS+= $(BIN)/blockdev.o $(BIN)/eltorito.o $(BIN)/fsys_ext2fs.o $(BIN)/fsys_fat.o $(BIN)/fsys_iso9660.o $(BIN)/fsys_reiserfs.o $(BIN)/vfs.o
  193. FILO_OBJS+= $(BIN)/fsys_jfs.o $(BIN)/fsys_minix.o $(BIN)/fsys_xfs.o
  194. FILO_OBJS+= $(BIN)/elfload.o $(BIN)/elfnote.o $(BIN)/filo_x.o $(BIN)/lib.o $(BIN)/linuxbios_x.o $(BIN)/malloc_x.o $(BIN)/printf_x.o $(BIN)/console_x.o
  195. FILO_OBJS+= $(BIN)/context.o $(BIN)/linux_load.o $(BIN)/segment.o $(BIN)/sys_info.o $(BIN)/switch.o
  196. FILO_OBJS+= $(BIN)/debug_x.o $(BIN)/scsi_cmds.o $(BIN)/uhci.o $(BIN)/usb.o $(BIN)/ohci.o $(BIN)/usb_scsi_low.o $(BIN)/usb_x.o
  197. BLIB= $(BIN)/bootlib.a
  198. FILOLIB= $(BIN)/filolib.a
  199. LIBS= $(BLIB)
  200. ifdef INCLUDE_FILO
  201. LIBS+= $(FILOLIB)
  202. endif
  203. UTILS+= $(BIN)/nrv2b
  204. STDDEPS= $(START) $(UTILS)
  205. # MAKEDEPS is the one target that is depended by all ROMs, so we check gcc here
  206. # If you are confident that gcc 2.96 works for you, you can remove the lines
  207. # that check gcc in the toolcheck rule
  208. MAKEDEPS+= Makefile Makefile.main Config genrules.pl Families
  209. MAKEDEPS+= $(BIN)/toolcheck
  210. MAKEDEPS+= arch/$(ARCH)/Makefile arch/$(ARCH)/Config
  211. # Start of targets
  212. .PHONY: noargs
  213. noargs: $(BIN)/toolcheck
  214. @echo '===================================================='
  215. @echo 'No target specified. To specify a target, do: '
  216. @echo
  217. @echo ' $(MAKE) bin/<rom-name>.<output-format> '
  218. @echo
  219. @echo 'where <output-format> is one of {zdsk, zrom, iso, liso, zlilo, zpxe, elf, com}'
  220. @echo
  221. @echo 'or: '
  222. @echo
  223. @echo ' $(MAKE) all<output-format>s'
  224. @echo
  225. @echo 'to generate all possible images of format <output-format>'
  226. @echo
  227. @echo 'For example, '
  228. @echo
  229. @echo ' make allzroms '
  230. @echo
  231. @echo 'will generate all possible .zrom (rom burnable) images, and'
  232. @echo
  233. @echo ' make allzdsks'
  234. @echo
  235. @echo 'will generate all possible .zdsk (bootable floppy) images, or'
  236. @echo
  237. @echo '===================================================='
  238. @exit 1
  239. $(BIN)/toolcheck: Makefile Config
  240. @if $(CC) -v 2>&1 | grep -is 'gcc version 2\.96' > /dev/null; \
  241. then \
  242. echo 'gcc 2.96 is unsuitable for compiling Etherboot'; \
  243. echo 'Use gcc 2.95 or gcc 3.x instead'; \
  244. exit 1; \
  245. else \
  246. touch $(BIN)/toolcheck; \
  247. fi; \
  248. if [ `perl -e 'use bytes; print chr(255)' | wc -c` = 2 ]; \
  249. then \
  250. echo 'Your Perl version has a Unicode handling bug'; \
  251. echo 'To workaround, execute this before compiling Etherboot:'; \
  252. echo 'export LANG=$${LANG%.UTF-8}'; \
  253. exit 1; \
  254. fi
  255. include arch/$(ARCH)/Makefile
  256. # Common files
  257. $(BLIB): $(BOBJS)
  258. $(AR) r $@ $(BOBJS)
  259. $(RANLIB) $@
  260. $(FILOLIB): $(FILO_OBJS)
  261. $(AR) r $@ $(FILO_OBJS)
  262. $(RANLIB) $@
  263. # LinuxBIOS support code
  264. $(BIN)/linuxbios.o: firmware/linuxbios/linuxbios.c include/etherboot.h include/dev.h firmware/linuxbios/linuxbios_tables.h
  265. # Do not add driver specific dependencies here unless it's something the
  266. # genrules.pl script *can't* deal with, i.e. if it is not C code.
  267. $(FILO)/config.h: $(FILO)/Config
  268. /bin/echo -e '/* GENERATED FILE, DO NOT EDIT */\n' >$@
  269. sed -e 's/#.*//' -e '/=/!d' -e 's/\([^[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\).*/#define \1 \2/' -e 's/^#define \([^ ]*\) 0$$/#undef \1/' $^ >>$@
  270. filo_version: $(FILO)/main/version.h
  271. $(FILO)/main/version.h: FORCE
  272. echo '#define PROGRAM_NAME "$(FILO_PROGRAM_NAME)"' > $@
  273. echo '#define PROGRAM_VERSION "$(FILO_PROGRAM_VERSION) $(FILO_BUILD_INFO)"' >> $@
  274. FORCE:
  275. # Utilities
  276. $(BIN)/lzhuf: util/lzhuf.c
  277. $(HOST_CC) -O2 -DENCODE -DDECODE -DMAIN -DVERBOSE -o $@ $<
  278. # Roms file
  279. # Builds almost silently because this rule is triggered for just about
  280. # every modification to sources.
  281. $(BIN)/Roms $(BIN)/NIC: genrules.pl Families $(SRCS)
  282. @mkdir -p $(@D)
  283. @echo Scanning for ROMs and dependencies...
  284. @$(PERL) ./genrules.pl Families $(BIN)/NIC $(ARCH) $(SRCS) > $(BIN)/Roms
  285. # Pattern Rules
  286. # general rules for compiling/assembling source files
  287. $(BIN)/%.o: core/%.c $(MAKEDEPS)
  288. $(CC) $(CFLAGS) -o $@ -c $<
  289. $(BIN)/%.s: core/%.c $(MAKEDEPS)
  290. $(CC) $(CFLAGS) -S -o $@ -c $<
  291. $(BIN)/%.o: drivers/disk/%.c $(MAKEDEPS)
  292. $(CC) $(CFLAGS) -o $@ -c $<
  293. $(BIN)/%.o: drivers/net/%.c $(MAKEDEPS)
  294. $(CC) $(CFLAGS) -o $@ -c $<
  295. $(BIN)/%.o: firmware/linuxbios/%.c $(MAKEDEPS)
  296. $(CC) $(CFLAGS) -o $@ -c $<
  297. $(BIN)/%.o: $(FILO)/drivers/%.c $(MAKEDEPS) $(FILO)/config.h
  298. $(CC) $(CFLAGS) -imacros $(FILO)/config.h -o $@ -c $<
  299. $(BIN)/%.o: $(FILO)/fs/%.c $(MAKEDEPS) $(FILO)/config.h
  300. $(CC) $(CFLAGS) -imacros $(FILO)/config.h -o $@ -c $<
  301. $(BIN)/%.o: $(FILO)/$(ARCH)/%.c $(MAKEDEPS) $(FILO)/config.h
  302. $(CC) $(CFLAGS) -imacros $(FILO)/config.h -o $@ -c $<
  303. $(BIN)/%.o: $(FILO)/$(ARCH)/%.S $(MAKEDEPS) $(FILO)/config.h
  304. $(CC) $(ASFLAGS_X) $(CPPFLAGS) -c $< -o $@
  305. $(BIN)/%.o: $(FILO)/main/%.c $(MAKEDEPS) $(FILO)/config.h filo_version
  306. $(CC) $(CFLAGS) -imacros $(FILO)/config.h -o $@ -c $<
  307. $(BIN)/%.o: $(FILO)/usb/%.c $(MAKEDEPS) $(FILO)/config.h
  308. $(CC) $(CFLAGS) -imacros $(FILO)/config.h -o $@ -c $<
  309. # Rule for the super etherboot image.
  310. $(BIN)/etherboot.o: $(DOBJS)
  311. $(LD) $(LDFLAGS) -r $(DOBJS) -o $@
  312. $(BIN)/etherboot-pci.o: $(PCIOBJS)
  313. $(LD) $(LDFLAGS) -r $(PCIOBJS) -o $@
  314. # General rules for generating runtime (rt) files
  315. $(BIN)/%.rt.o: $(BIN)/%.o $(START) $(BIN)/config.o $(LIBS) $(STDDEPS) $(MAKEDEPS)
  316. $(LD) $(LDFLAGS) -r $(START) $(BIN)/config.o $< $(LIBS) -o $@
  317. # Rule for $(BIN)/%.FORMAT.rt is architecture and target-format specific
  318. $(BIN)/%.rt.bin: $(BIN)/%.rt $(MAKEDEPS)
  319. $(OBJCOPY) -O binary -R .prefix $< $@
  320. $(BIN)/%.rt1.bin: $(BIN)/%.rt $(MAKEDEPS)
  321. $(OBJCOPY) -O binary -j .text.nocompress $< $@
  322. $(BIN)/%.rt2.bin: $(BIN)/%.rt $(MAKEDEPS)
  323. $(OBJCOPY) -O binary -R .prefix -R .text.nocompress $< $@
  324. # Rules for generating prefix binary files
  325. # Rule for $(BIN)/%.FORMAT.prf is architecture and target-format specific
  326. $(BIN)/%.prf.bin: $(BIN)/%.prf $(MAKEDEPS)
  327. $(OBJCOPY) -j .prefix -O binary $< $@
  328. # general rule for .z (compressed binary code), may be overridden
  329. $(BIN)/%.zbin: $(BIN)/%.bin $(BIN)/nrv2b $(MAKEDEPS)
  330. $(BIN)/nrv2b e $< $@
  331. # Housekeeping
  332. clean:
  333. $(RM) $(BIN)/*
  334. $(RM) $(FILO)/config.h $(FILO)/main/version.h
  335. ../index.html: ../index.xhtml
  336. (cd ..; m4 -P -DHOSTSITE=SOURCEFORGE index.xhtml > index.html)
  337. ../index-berlios.html: ../index.xhtml
  338. (cd ..; m4 -P -DHOSTSITE=BERLIOS index.xhtml > index-berlios.html)
  339. tarball: ../index.html ../index-berlios.html
  340. (echo -n $(VERSION) ''; date -u +'%Y-%m-%d') > ../VERSION
  341. (cd ../..; tar cf /tmp/etherboot-$(VERSION).tar --exclude CVS --exclude doc etherboot-$(VERSION))
  342. bzip2 -9 < /tmp/etherboot-$(VERSION).tar > /tmp/etherboot-$(VERSION).tar.bz2
  343. gzip -9 < /tmp/etherboot-$(VERSION).tar > /tmp/etherboot-$(VERSION).tar.gz
  344. # Auto-incrementing build serial number. Is auto-incremented for each
  345. # make run that specifies a final image file (e.g. bin/undi.zpxe) as a
  346. # target, or a target of the form "all*". Enable via -DBUILD_SERIAL
  347. # in Config.
  348. ifneq ($(findstring -DBUILD_SERIAL,$(CFLAGS)),)
  349. # If no make goals are specified, it means "make all"
  350. REALGOALS = $(if $(MAKECMDGOALS),$(MAKECMDGOALS),all)
  351. # Filter to see if there are any targets to trigger an auto-increment
  352. BUILDGOALS = $(filter all,$(REALGOALS)) $(filter all%,$(REALGOALS)) \
  353. $(foreach SUFFIX,$(SUFFIXES),$(filter %.$(SUFFIX),$(REALGOALS)))
  354. ifneq ($(strip $(BUILDGOALS)),)
  355. # This is an auto-incrementing build. Forcibly rebuild .buildserial.h
  356. # and mark config.o as depending on it to force its rebuilding.
  357. bin/config.o : include/.buildserial.h
  358. .PHONY : include/.buildserial.h
  359. endif # BUILDGOALS
  360. include/.buildserial.h :
  361. @if [ ! -f $@ ]; then echo '#define BUILD_SERIAL_NUM 0' > $@; fi
  362. @perl -pi -e 's/(BUILD_SERIAL_NUM)\s+(\d+)/"$${1} ".($${2}+1)/e' $@
  363. buildserial : include/.buildserial.h
  364. @perl -n -e '/BUILD_SERIAL_NUM\s+(\d+)/ && ' \
  365. -e 'print "Build serial number is $$1\n";' $<
  366. else # -DBUILD_SERIAL
  367. buildserial :
  368. @echo Build serial number is disabled. Enable -DBUILD_SERIAL in Config.
  369. endif # -DBUILD_SERIAL
  370. bs : buildserial
  371. version:
  372. @echo $(VERSION)
  373. romlimit:
  374. @echo $(ROMLIMIT)
  375. sources:
  376. @echo $(SRCS)