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 4.5KB

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