1 # Initialise variables that get added to throughout the various Makefiles
3 MAKEDEPS
:= Makefile .toolcheck
12 # Grab the central Config file.
17 # If no architecture is specified in Config or on the command-line,
18 # use that of the build machine.
21 ARCH
:= $(shell uname
-m | sed
-e s
,i
[3456789]86,i386
,)
24 # Drag in architecture-specific Config
26 MAKEDEPS
+= arch
/$(ARCH
)/Config
27 include arch
/$(ARCH
)/Config
29 # If invoked with no build target, print out a helpfully suggestive
33 @echo
'===================================================='
35 @echo
' *** WARNING: THE INSTRUCTIONS BELOW DO NOT FULLY WORK YET !!! ***'
36 @echo
' *** PLEASE STAY TUNED ***'
38 @echo
'No target specified. To specify a target, do: '
40 @echo
' make bin/<rom-name>.<output-format> '
42 @echo
'where <output-format> is one of {$(MEDIA) }'
46 @echo
' make all<output-format>s'
48 @echo
'to generate all possible images of format <output-format>'
52 @echo
' make allzroms '
54 @echo
'will generate all possible .zrom (rom burnable) images, and'
56 @echo
' make allzdsks'
58 @echo
'will generate all possible .zdsk (bootable floppy) images, or'
60 @echo
'===================================================='
63 # Locations of utilities
66 CPP ?
= gcc
-E
-Wp
,-Wall
71 CC ?
= $(CROSS_COMPILE
)gcc
72 AS ?
= $(CROSS_COMPILE
)as
73 LD ?
= $(CROSS_COMPILE
)ld
74 SIZE ?
= $(CROSS_COMPILE
)size
75 AR ?
= $(CROSS_COMPILE
)ar
76 RANLIB ?
= $(CROSS_COMPILE
)ranlib
77 OBJCOPY ?
= $(CROSS_COMPILE
)objcopy
78 NM ?
= $(CROSS_COMPILE
)nm
79 OBJDUMP ?
= $(CROSS_COMPILE
)objdump
80 PARSEROM ?
= $(PERL
) .
/util
/parserom.pl
81 MAKEROM ?
= $(PERL
) .
/util
/makerom.pl
82 MKCONFIG ?
= $(PERL
) .
/util
/mkconfig.pl
83 SYMCHECK ?
= $(PERL
) .
/util
/symcheck.pl
84 SORTOBJDUMP ?
= $(PERL
) .
/util
/sortobjdump.pl
88 # Location to place generated files
94 CFLAGS
+= -I
include -I arch
/$(ARCH
)/include -I .
-DARCH
=$(ARCH
)
95 CFLAGS
+= -Os
-ffreestanding
98 CFLAGS
+= $(EXTRA_CFLAGS
)
99 ASFLAGS
+= $(EXTRA_ASFLAGS
)
100 LDFLAGS
+= $(EXTRA_LDFLAGS
)
102 # CFLAGS for specific object types
105 CFLAGS_S
+= -DASSEMBLY
107 # Base object name of the current target
109 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.
115 OBJ_CFLAGS
= $(CFLAGS_
$(OBJECT
)) -DOBJECT
=$(subst -,_
,$(OBJECT
))
119 # Rules for specific object types.
121 COMPILE_c
= $(CC
) $(CFLAGS
) $(CFLAGS_c
) $(OBJ_CFLAGS
)
122 RULE_c
= $(Q
)$(COMPILE_c
) -c
$< -o
$@
123 RULE_c_to_dbg
%.o
= $(Q
)$(COMPILE_c
) -Ddebug_
$(OBJECT
)=$* -c
$< -o
$@
124 RULE_c_to_c
= $(Q
)$(COMPILE_c
) -E
-c
$< > $@
125 RULE_c_to_s
= $(Q
)$(COMPILE_c
) -S
-g0
-c
$< -o
$@
127 PREPROCESS_S
= $(CPP
) $(CFLAGS
) $(CFLAGS_S
) $(OBJ_CFLAGS
)
128 ASSEMBLE_S
= $(AS
) $(ASFLAGS
)
129 RULE_S
= $(Q
)$(PREPROCESS_S
) $< |
$(ASSEMBLE_S
) -o
$@
130 RULE_S_to_s
= $(Q
)$(PREPROCESS_S
) $< > $@
132 DEBUG_TARGETS
+= dbg
%.o c s
134 # SRCDIRS lists all directories containing source files.
138 SRCDIRS
+= net net
/tcp net
/udp
140 SRCDIRS
+= drivers
/bus
141 SRCDIRS
+= drivers
/net
142 SRCDIRS
+= drivers
/block
143 SRCDIRS
+= drivers
/scsi
144 SRCDIRS
+= drivers
/ata
145 SRCDIRS
+= drivers
/nvs
146 SRCDIRS
+= drivers
/bitbash
147 SRCDIRS
+= interface
/pxe
149 SRCDIRS
+= crypto crypto
/axtls crypto
/matrixssl
150 SRCDIRS
+= hci hci
/commands hci
/tui
151 SRCDIRS
+= hci
/mucurses hci
/mucurses
/widgets
154 # NON_AUTO_SRCS lists files that are excluded from the normal
155 # automatic build system.
157 NON_AUTO_SRCS
+= core
/elf_loader.c
158 NON_AUTO_SRCS
+= drivers
/net
/prism2.c
160 # Rules for finalising files. TGT_MAKEROM_FLAGS is defined as part of
161 # the automatic build system and varies by target; it includes the
162 # "-p 0x1234,0x5678" string to set the PCI IDs.
164 FINALISE_rom
= $(MAKEROM
) $(MAKEROM_FLAGS
) $(TGT_MAKEROM_FLAGS
) \
167 # Some ROMs require specific flags to be passed to makerom.pl
169 MAKEROM_FLAGS_3c503
= -3
171 # Drag in architecture-specific Makefile
173 MAKEDEPS
+= arch
/$(ARCH
)/Makefile
174 include arch
/$(ARCH
)/Makefile
176 # Drag in the automatic build system and other housekeeping functions
177 MAKEDEPS
+= Makefile.housekeeping
178 include Makefile.housekeeping