Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Makefile 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 : blib
  29. @echo '===================================================='
  30. @echo 'No target specified. To specify a target, do: '
  31. @echo
  32. @echo ' $(MAKE) bin/<rom-name>.<output-format> '
  33. @echo
  34. @echo 'where <output-format> is one of [z]{$(MEDIA) }'
  35. @echo
  36. @echo 'or: '
  37. @echo
  38. @echo ' $(MAKE) all<output-format>s'
  39. @echo
  40. @echo 'to generate all possible images of format <output-format>'
  41. @echo
  42. @echo 'For example, '
  43. @echo
  44. @echo ' make allzroms '
  45. @echo
  46. @echo 'will generate all possible .zrom (rom burnable) images, and'
  47. @echo
  48. @echo ' make allzdsks'
  49. @echo
  50. @echo 'will generate all possible .zdsk (bootable floppy) images, or'
  51. @echo
  52. @echo '===================================================='
  53. @exit 1
  54. # Locations of utilities
  55. #
  56. HOST_CC ?= gcc
  57. CPP ?= gcc -E -Wp,-Wall
  58. RM ?= rm -f
  59. TOUCH ?= touch
  60. MKDIR ?= mkdir
  61. PERL ?= /usr/bin/perl
  62. CC ?= $(CROSS_COMPILE)gcc
  63. AS ?= $(CROSS_COMPILE)as
  64. LD ?= $(CROSS_COMPILE)ld
  65. SIZE ?= $(CROSS_COMPILE)size
  66. AR ?= $(CROSS_COMPILE)ar
  67. RANLIB ?= $(CROSS_COMPILE)ranlib
  68. OBJCOPY ?= $(CROSS_COMPILE)objcopy
  69. PARSEROM ?= $(PERL) ./util/parserom.pl
  70. MAKEROM ?= $(PERL) ./util/makerom.pl
  71. MKCONFIG ?= $(PERL) ./util/mkconfig.pl
  72. NRV2B ?= ./util/nrv2b
  73. # Location to place generated files
  74. #
  75. BIN ?= bin
  76. # Common flags
  77. #
  78. CFLAGS += -I include -I arch/$(ARCH)/include -I . -DARCH=$(ARCH)
  79. CFLAGS += -Os -ffreestanding
  80. CFLAGS += -Wall -W -Wno-format
  81. CFLAGS += $(EXTRA_CFLAGS)
  82. ASFLAGS += $(EXTRA_ASFLAGS)
  83. LDFLAGS += $(EXTRA_LDFLAGS)
  84. # CFLAGS for specific object types
  85. #
  86. CFLAGS_c +=
  87. CFLAGS_S += -DASSEMBLY
  88. # Base object name of the current target
  89. #
  90. OBJECT = $(firstword $(subst ., ,$(@F)))
  91. # CFLAGS for specific object files. You can define
  92. # e.g. CFLAGS_rtl8139, and have those flags automatically used when
  93. # compiling bin/rtl8139.o.
  94. #
  95. OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
  96. $(BIN)/%.flags :
  97. @echo $(OBJ_CFLAGS)
  98. # Rules for specific object types.
  99. #
  100. COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
  101. RULE_c = $(COMPILE_c) -c $< -o $@
  102. RULE_c_to_dbg.o = $(COMPILE_c) -Ddebug_$(OBJECT) -c $< -o $@
  103. RULE_c_to_c = $(COMPILE_c) -E -c $< > $@
  104. RULE_c_to_s = $(COMPILE_c) -S -c $< -o $@
  105. PREPROCESS_S = $(CPP) $(CFLAGS) $(CFLAGS_S) $(OBJ_CFLAGS)
  106. ASSEMBLE_S = $(AS) $(ASFLAGS)
  107. RULE_S = $(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@
  108. RULE_S_to_s = $(PREPROCESS_S) $< > $@
  109. DEBUG_TARGETS += dbg.o c s
  110. # SRCDIRS lists all directories containing source files.
  111. #
  112. SRCDIRS += core drivers/bus drivers/net
  113. # drivers/disk
  114. # NON_AUTO_SRCS lists files that are excluded from the normal
  115. # automatic build system.
  116. #
  117. NON_AUTO_SRCS += core/elf_loader.c
  118. NON_AUTO_SRCS += drivers/net/prism2.c
  119. # Rules for finalising files. TGT_MAKEROM_FLAGS is defined as part of
  120. # the automatic build system and varies by target; it includes the
  121. # "-p 0x1234,0x5678" string to set the PCI IDs.
  122. #
  123. FINALISE_rom = $(MAKEROM) $(MAKEROM_FLAGS) $(TGT_MAKEROM_FLAGS) \
  124. -i$(IDENT) $@
  125. # Some ROMs require specific flags to be passed to makerom.pl
  126. #
  127. MAKEROM_FLAGS_3c503 = -3
  128. # Drag in architecture-specific Makefile
  129. #
  130. MAKEDEPS += arch/$(ARCH)/Makefile
  131. include arch/$(ARCH)/Makefile
  132. # Drag in the automatic build system and other housekeeping functions
  133. MAKEDEPS += Makefile.housekeeping
  134. include Makefile.housekeeping