選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Makefile 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. # Initialise variables that get added to throughout the various Makefiles
  2. #
  3. MAKEDEPS := Makefile .toolcheck
  4. SRCDIRS :=
  5. SRCS :=
  6. NON_AUTO_SRCS :=
  7. DRIVERS :=
  8. ROMS :=
  9. MEDIA :=
  10. NON_AUTO_MEDIA :=
  11. # Grab the central Config file.
  12. #
  13. MAKEDEPS += Config
  14. include Config
  15. # Location to place generated files
  16. #
  17. BIN := bin
  18. # If no architecture is specified in Config or on the command-line,
  19. # use that of the build machine.
  20. #
  21. ifndef ARCH
  22. ARCH := $(shell uname -m | sed -e s,i[3456789]86,i386,)
  23. endif
  24. # handle x86_64 like i386, but set -m32 option for 32bit code only
  25. ifeq ($(ARCH),x86_64)
  26. ARCH := i386
  27. CFLAGS += -m32
  28. endif
  29. # Drag in architecture-specific Config
  30. #
  31. MAKEDEPS += arch/$(ARCH)/Config
  32. include arch/$(ARCH)/Config
  33. # If invoked with no build target, print out a helpfully suggestive
  34. # message.
  35. #
  36. noargs : blib $(BIN)/NIC
  37. @echo '===================================================='
  38. @echo
  39. @echo ' *** WARNING: THE INSTRUCTIONS BELOW DO NOT FULLY WORK YET !!! ***'
  40. @echo ' *** PLEASE STAY TUNED ***'
  41. @echo
  42. @echo 'No target specified. To specify a target, do: '
  43. @echo
  44. @echo ' make bin/<rom-name>.<output-format> '
  45. @echo
  46. @echo 'where <output-format> is one of {$(MEDIA) }'
  47. @echo
  48. @echo 'or: '
  49. @echo
  50. @echo ' make all<output-format>s'
  51. @echo
  52. @echo 'to generate all possible images of format <output-format>'
  53. @echo
  54. @echo 'For example, '
  55. @echo
  56. @echo ' make allroms '
  57. @echo
  58. @echo 'will generate all possible .rom (rom burnable) images, and'
  59. @echo
  60. @echo ' make alldsks'
  61. @echo
  62. @echo 'will generate all possible .dsk (bootable floppy) images, or'
  63. @echo
  64. @echo '===================================================='
  65. @exit 1
  66. # Locations of utilities
  67. #
  68. HOST_CC ?= gcc
  69. CPP ?= gcc -E -Wp,-Wall
  70. RM ?= rm -f
  71. TOUCH ?= touch
  72. MKDIR ?= mkdir
  73. CP ?= cp
  74. PERL ?= /usr/bin/perl
  75. CC ?= $(CROSS_COMPILE)gcc
  76. AS ?= $(CROSS_COMPILE)as
  77. LD ?= $(CROSS_COMPILE)ld
  78. SIZE ?= $(CROSS_COMPILE)size
  79. AR ?= $(CROSS_COMPILE)ar
  80. RANLIB ?= $(CROSS_COMPILE)ranlib
  81. OBJCOPY ?= $(CROSS_COMPILE)objcopy
  82. NM ?= $(CROSS_COMPILE)nm
  83. OBJDUMP ?= $(CROSS_COMPILE)objdump
  84. PARSEROM ?= $(PERL) ./util/parserom.pl
  85. MAKEROM ?= $(PERL) ./util/makerom.pl
  86. MKCONFIG ?= $(PERL) ./util/mkconfig.pl
  87. SYMCHECK ?= $(PERL) ./util/symcheck.pl
  88. SORTOBJDUMP ?= $(PERL) ./util/sortobjdump.pl
  89. NRV2B ?= ./util/nrv2b
  90. ZBIN ?= ./util/zbin
  91. DOXYGEN ?= doxygen
  92. # Common flags
  93. #
  94. CFLAGS += -I include -I arch/$(ARCH)/include -I . -DARCH=$(ARCH)
  95. CFLAGS += -Os -ffreestanding
  96. CFLAGS += -Wall -W
  97. CFLAGS += -g
  98. CFLAGS += $(EXTRA_CFLAGS)
  99. ASFLAGS += $(EXTRA_ASFLAGS)
  100. LDFLAGS += $(EXTRA_LDFLAGS)
  101. ifneq ($(NO_WERROR),1)
  102. CFLAGS += -Werror
  103. endif
  104. # CFLAGS for specific object types
  105. #
  106. CFLAGS_c +=
  107. CFLAGS_S += -DASSEMBLY
  108. # Base object name of the current target
  109. #
  110. OBJECT = $(firstword $(subst ., ,$(@F)))
  111. # CFLAGS for specific object files. You can define
  112. # e.g. CFLAGS_rtl8139, and have those flags automatically used when
  113. # compiling bin/rtl8139.o.
  114. #
  115. OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
  116. $(BIN)/%.flags :
  117. @echo $(OBJ_CFLAGS)
  118. # Rules for specific object types.
  119. #
  120. COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
  121. RULE_c = $(Q)$(COMPILE_c) -c $< -o $@
  122. RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -Ddebug_$(OBJECT)=$* -c $< -o $@
  123. RULE_c_to_c = $(Q)$(COMPILE_c) -E -c $< > $@
  124. RULE_c_to_s = $(Q)$(COMPILE_c) -S -g0 -c $< -o $@
  125. PREPROCESS_S = $(CPP) $(CFLAGS) $(CFLAGS_S) $(OBJ_CFLAGS)
  126. ASSEMBLE_S = $(AS) $(ASFLAGS)
  127. RULE_S = $(Q)$(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@
  128. RULE_S_to_s = $(Q)$(PREPROCESS_S) $< > $@
  129. DEBUG_TARGETS += dbg%.o c s
  130. # SRCDIRS lists all directories containing source files.
  131. #
  132. SRCDIRS += libgcc
  133. SRCDIRS += core
  134. SRCDIRS += proto
  135. SRCDIRS += net net/tcp net/udp
  136. SRCDIRS += image
  137. SRCDIRS += drivers/bus
  138. SRCDIRS += drivers/net
  139. SRCDIRS += drivers/block
  140. SRCDIRS += drivers/scsi
  141. SRCDIRS += drivers/ata
  142. SRCDIRS += drivers/nvs
  143. SRCDIRS += drivers/bitbash
  144. SRCDIRS += interface/pxe
  145. SRCDIRS += tests
  146. SRCDIRS += crypto crypto/axtls crypto/matrixssl
  147. SRCDIRS += hci hci/commands hci/tui
  148. SRCDIRS += hci/mucurses hci/mucurses/widgets
  149. SRCDIRS += usr
  150. # NON_AUTO_SRCS lists files that are excluded from the normal
  151. # automatic build system.
  152. #
  153. NON_AUTO_SRCS += core/elf_loader.c
  154. NON_AUTO_SRCS += drivers/net/prism2.c
  155. # Rules for finalising files. TGT_MAKEROM_FLAGS is defined as part of
  156. # the automatic build system and varies by target; it includes the
  157. # "-p 0x1234,0x5678" string to set the PCI IDs.
  158. #
  159. FINALISE_rom = $(MAKEROM) $(MAKEROM_FLAGS) $(TGT_MAKEROM_FLAGS) \
  160. -i$(IDENT) -s 0 $@
  161. # Some ROMs require specific flags to be passed to makerom.pl
  162. #
  163. MAKEROM_FLAGS_3c503 = -3
  164. # Drag in architecture-specific Makefile
  165. #
  166. MAKEDEPS += arch/$(ARCH)/Makefile
  167. include arch/$(ARCH)/Makefile
  168. # Drag in the automatic build system and other housekeeping functions
  169. MAKEDEPS += Makefile.housekeeping
  170. include Makefile.housekeeping