1 # Copyright © 2000-2019, The AROS Development Team. All rights reserved.
4 # Main makefile for AROS
8 AROS_BUILD_HOST ?
= @aros_build_host@
9 AROS_HOST_CPU ?
= @aros_host_cpu@
10 AROS_HOST_ARCH ?
= @aros_host_arch@
11 AROS_TARGET_CPU ?
= @aros_target_cpu@
12 AROS_TARGET_CPU_MODE ?
= @aros_target_cpu_mode@
13 AROS_TARGET_ARCH ?
= @aros_target_arch@
14 AROS_TARGET_VARIANT ?
= @aros_target_variant@
16 AMIGAOSNDKDIR ?
= $(SRCDIR
)/local
/NDK_3.1
18 # normally, these variable's should go in mmake.config/globalvarfile
19 export AROS_TARGET_BOOTLOADER
:= @aros_target_bootloader@
20 export AROS_TARGET_ICONSET
:= @aros_target_iconset@
21 export AROS_GUI_THEME
:= @aros_target_guitheme@
23 TOP
:= @AROS_BUILDDIR@
25 include $(TOP
)/config
/make.cfg
26 ifneq ($(CROSSTOOLS_TARGET
),)
27 include $(SRCDIR
)/tools
/crosstools
/$(AROS_TOOLCHAIN
).cfg
28 include $(SRCDIR
)/tools
/crosstools
/$(AROS_TOOLCHAIN
).deps
29 CROSSTOOLS_BUILDFLAG
:=$(CROSSTOOLSDIR
)/.installflag-crosstools
30 AROS_TOOLCHAIN_DEPS
:=$(AROS_TOOLCHAIN_DEPS
) $(SRCDIR
)/tools
/crosstools
/$(AROS_TOOLCHAIN
).cfg
$(SRCDIR
)/tools
/crosstools
/$(AROS_TOOLCHAIN
).deps
$(SRCDIR
)/tools
/crosstools
/mmakefile.src
32 CROSSTOOLS_BUILDFLAG
:=
35 MMAKE_OPTIONS ?
= --srcdir=$(SRCDIR
) --builddir
=$(TOP
)
36 ifneq (,$(findstring s
,$(MAKEFLAGS
)))
41 # Rules for Configure generated files ...
44 #$(TOP)/Makefile: $(SRCDIR)/Makefile.in $(TOP)/config.status
45 # @+$(ECHO) "Regenerating " $(subst $(TOP)/,,$@); \
46 # @$(TOP)/config.status --silent --file=$@:$<
48 #CONFIGUREFILES += $(TOP)/Makefile
50 $(TOP
)/mmake.config
: $(SRCDIR
)/mmake.config.in
$(TOP
)/config.status
51 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
52 @
$(TOP
)/config.status
--silent
--file
=$@
:$<
54 CONFIGUREFILES
+= $(TOP
)/mmake.config
56 $(TOP
)/config
/make.cfg
: $(SRCDIR
)/config
/make.cfg.in
$(TOP
)/config.status
57 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
58 @
$(TOP
)/config.status
--silent
--file
=$@
:$<
60 CONFIGUREFILES
+= $(TOP
)/config
/make.cfg
62 $(TOP
)/compiler
/include/geninc.cfg
: $(SRCDIR
)/compiler
/include/geninc.cfg.in
$(TOP
)/config.status
63 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
64 @
$(TOP
)/config.status
--silent
--file
=$@
:$<
66 CONFIGUREFILES
+= $(TOP
)/compiler
/include/geninc.cfg
68 $(AROS_INCLUDES
)/aros
/config.h
: $(SRCDIR
)/config
/config.h.in
$(TOP
)/config.status
69 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
70 @
$(TOP
)/config.status
--silent
--file
=$@
:$<
72 CONFIGUREFILES
+= $(AROS_INCLUDES
)/aros
/config.h
74 $(GENINCDIR
)/aros
/config.h
: $(SRCDIR
)/config
/config.h.in
$(TOP
)/config.status
75 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
76 @
$(TOP
)/config.status
--silent
--file
=$@
:$<
78 CONFIGUREFILES
+= $(GENINCDIR
)/aros
/config.h
80 $(GENDIR
)/config
/target.cfg
: $(SRCDIR
)/config
/target.cfg.in
$(TOP
)/config.status
81 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
82 @
$(TOP
)/config.status
--silent
--file
=$@
:$<
84 CONFIGUREFILES
+= $(GENDIR
)/config
/target.cfg
86 $(GENDIR
)/config
/build.cfg
: $(SRCDIR
)/config
/build.cfg.in
$(TOP
)/config.status
87 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
88 @
$(TOP
)/config.status
--silent
--file
=$@
:$<
90 CONFIGUREFILES
+= $(GENDIR
)/config
/build.cfg
92 $(GENDIR
)/config
/make.defaults
: $(SRCDIR
)/config
/make.defaults.in
$(TOP
)/config.status
93 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
94 @
$(TOP
)/config.status
--silent
--file
=$@
:$<
96 CONFIGUREFILES
+= $(GENDIR
)/config
/make.defaults
98 $(HOSTGENDIR
)/config
/host.cfg
: $(SRCDIR
)/config
/host.cfg.in
$(TOP
)/config.status
99 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
100 @
$(TOP
)/config.status
--silent
--file
=$@
:$<
102 CONFIGUREFILES
+= $(HOSTGENDIR
)/config
/host.cfg
108 all: $(CONFIGUREFILES
) crosstools features
109 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.AROS
113 @
$(FOR
) dir in
$(AROSDIR
) $(GENDIR
) $(TOOLDIR
) ; do \
114 $(IF
) [ ! -d
$$dir ]; then \
115 $(MECHO
) $(MKDIR
) "$$dir" ; \
119 @
$(IF
) [ ! -f
$(AROSDIR
)/.gdbinit
]; then \
120 $(CP
) $(SRCDIR
)/_gdbinit
$(AROSDIR
)/.gdbinit
; \
123 $(PARSEOFFSETS
): $(wildcard $(SRCDIR
)/tools
/parseoffsets
/*.
[ch
])
124 @
$(ECHO
) Building parseoffsets...
125 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/parseoffsets SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
127 parsesdkoffsets
: $(PARSEOFFSETS
)
128 @
$(IF
) [ ! -d
$(AMIGAOSNDKDIR
) ]; then \
129 $(ECHO
) "Please copy the AmigaOS 3.1 (tm) NDK files to $(AMIGAOSNDKDIR)" ; \
131 $(ECHO
) "Parsing Structure.Offsets file..." ; \
132 $(PARSEOFFSETS
) --offsetsfile
=$(AMIGAOSNDKDIR
)/Includes_Libs
/StructOffsets
/Structure.Offsets
--gendir
=$(GENDIR
)/tools
/parseoffsets
--bindir=$(AROS_TESTS
)/sdk
--sdkdir
=$(AROS_INCLUDES
) ; \
135 # Create the tools that are used to build AROS.
136 tools
: makedirs mmake
$(GENMFSCRIPT
) $(ARCHTOOL
) $(ELF2HUNK
) \
137 $(FLEXCAT
) $(CREATEDTDESC
) \
138 $(ILBMTOC
) $(ILBMTOICON
) $(INFOINFO
) \
139 $(COLLECT-AROS
) $(AFSLIB
) $(COPYTOAFS
) \
140 $(FD2INLINE
) $(FD2PRAGMA
) $(SFDC
) $(SETREV
) $(PARSEOFFSETS
)
143 # rebuild the crosstools if we are reconfigured, or its dependencies change.
144 $(CROSSTOOLSDIR
)/.installflag-crosstools
: $(TOP
)/config.status
$(SRCDIR
)/tools
/crosstools
/$(AROS_TOOLCHAIN
).cfg
$(SRCDIR
)/tools
/crosstools
/$(AROS_TOOLCHAIN
).deps
$(AROS_TOOLCHAIN_DEPS
) tools
145 @
+$(IF
) ! $(TEST
) -f
$@
; then \
146 $(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$(CROSSTOOLS_TARGET
) && $(TOUCH
) $@
; \
149 crosstools
: tools
$(CROSSTOOLS_BUILDFLAG
)
152 $(TOP
)/config
/features.status
: $(SRCDIR
)/config
/features
$(CROSSTOOLS_BUILDFLAG
)
153 @
$(IF
) ! $(TEST
) -f
$@
; then \
154 $(ECHO
) "Querying target compiler features..." ; \
155 cd
$(TOP
)/config
; CC
="$(TARGET_CC) $(TARGET_SYSROOT)" CFLAGS
="$(TARGET_CFLAGS) $(DEBUG_CFLAGS) $(OPTIMIZATION_CFLAGS)" CPP
="$(TARGET_CPP) $(TARGET_SYSROOT)" CXX
="$(TARGET_CXX) $(TARGET_SYSROOT)" CXXFLAGS
=" $(TARGET_CXXFLAGS) $(DEBUG_CFLAGS) $(OPTIMIZATION_CFLAGS)" CONFIG_STATUS
="features.status" $(SRCDIR
)/config
/features
--host
=$(AROS_BUILD_HOST
) --with-config-dir
=$(GENDIR
)/config
; \
158 features
: crosstools
$(TOP
)/config
/features.status
161 $(GENMFSCRIPT
): $(SRCDIR
)/tools
/genmf
/genmf.py
162 @
$(ECHO
) Generating
$(subst $(TOP
)/,,$(GENMFSCRIPT
))...
163 @
$(TOP
)/config.status
--silent
--file
=$(subst $(TOP
)/,,$@
):$<
165 $(ELF2HUNK
): $(SRCDIR
)/tools
/elf2hunk
/elf2hunk.c
166 @
$(ECHO
) Building elf2hunk...
167 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/elf2hunk SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
169 $(ARCHTOOL
): $(SRCDIR
)/tools
/archtools
/archtool.c
170 @
$(ECHO
) Building archtool...
171 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/archtools SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
173 $(FLEXCAT
): $(wildcard $(SRCDIR
)/tools
/flexcat
/src
/*.
[ch
]) $(wildcard $(SRCDIR
)/tools
/flexcat
/src
/sd
/*.sd
)
174 @
$(ECHO
) Building flexcat...
175 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/flexcat
/src
-f Makefile.aros SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
177 $(CREATEDTDESC
): $(wildcard $(SRCDIR
)/tools
/dtdesc
/*.
[ch
]) $(wildcard $(SRCDIR
)/tools
/dtdesc
/c_iff
/*.
[ch
])
178 @
$(ECHO
) Building createdtdesc...
179 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/dtdesc
-f Makefile.aros SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
181 $(AFSLIB
): $(wildcard $(SRCDIR
)/workbench
/devs
/afs
/*.
[ch
])
182 @
$(ECHO
) Building afslib...
183 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/copytoafs
-f Makefile.afslib SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
185 $(COPYTOAFS
): $(AFSLIB
) $(SRCDIR
)/tools
/copytoafs
/copytoafs.c
186 @
$(ECHO
) Building copytoafs...
187 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/copytoafs SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
189 $(ILBMTOC
): $(SRCDIR
)/tools
/ilbmtoc
/ilbmtoc.c
190 @
$(ECHO
) Building ilbmtoc...
191 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/ilbmtoc SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
193 $(ILBMTOICON
): $(SRCDIR
)/tools
/ilbmtoicon
/ilbmtoicon.c
194 @
$(ECHO
) Building ilbmtoicon...
195 @
$(CALL
) $(MAKE
) $(MKARGS
) $@
-C
$(SRCDIR
)/tools
/ilbmtoicon SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
197 $(INFOINFO
): $(SRCDIR
)/tools
/ilbmtoicon
/infoinfo.c
198 @
$(ECHO
) Building infoinfo...
199 @
$(CALL
) $(MAKE
) $(MKARGS
) $@
-C
$(SRCDIR
)/tools
/ilbmtoicon SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
201 $(COLLECT-AROS
): $(wildcard $(SRCDIR
)/tools
/collect-aros
/*.
[hc
])
202 @
$(ECHO
) Building collect-aros...
203 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/collect-aros SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
205 $(FD2INLINE
): $(SRCDIR
)/tools
/fd2inline
/fd2inline.c
206 @
$(ECHO
) Building fd2inline...
207 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2inline SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
209 $(FD2PRAGMA
): $(SRCDIR
)/tools
/fd2pragma
/fd2pragma.c
210 @
$(ECHO
) Building fd2pragma...
211 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2pragma SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
213 $(SFDC
): $(SRCDIR
)/tools
/sfdc
/*.pl
214 @
$(ECHO
) Building sfdc...
215 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/sfdc SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
217 $(SETREV
): $(SRCDIR
)/tools
/setrev
/setrev.c
218 @
$(ECHO
) Building setrev...
219 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/setrev SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
221 # MetaMake apparently requires a slighty different compilation. Probably
222 # because it is sort-of an external package as well.
224 mmake
: $(TOP
)/tools
/MetaMake
/Makefile
$(MMAKE
)
227 $(SRCDIR
)/tools
/MetaMake
/configure
: $(SRCDIR
)/tools
/MetaMake
/configure.in
228 @
$(ECHO
) Building MetaMake...
229 @cd
$(SRCDIR
)/tools
/MetaMake
&& @aros_host_aclocal@
&& @aros_host_autoconf@
231 $(TOP
)/tools
/MetaMake
/Makefile
: $(SRCDIR
)/tools
/MetaMake
/configure
$(SRCDIR
)/tools
/MetaMake
/Makefile.in
232 @
$(IF
) [ ! -d
$(TOP
)/tools
/MetaMake
]; then \
233 $(MECHO
) $(MKDIR
) "$(TOP)/tools/MetaMake" ; \
234 $(MKDIR
) "$(TOP)/tools/MetaMake"; \
236 @cd
$(TOP
)/tools
/MetaMake
; CC
="$(HOST_CC)" CFLAGS
="$(HOST_CFLAGS) -D_FILE_OFFSET_BITS=64" LDFLAGS
="$(HOST_LDFLAGS)" $(SRCDIR
)/tools
/MetaMake
/configure
--prefix=$(TOOLDIR
) --bindir=$(TOOLDIR
) --with-objfiledir
=$(HOSTGENDIR
)/tools
/MetaMake
238 $(MMAKE
): $(TOP
)/tools
/MetaMake
/Makefile
$(wildcard $(SRCDIR
)/tools
/MetaMake
/*.
[ch
]) $(GENMFSCRIPT
)
239 @
$(MAKE
) $(MKARGS
) AUTOHEADER
=@aros_host_autoheader@
-C
$(TOP
)/tools
/MetaMake
240 @
$(MAKE
) $(MKARGS
) -C
$(TOP
)/tools
/MetaMake
install
242 # Clean the sources and tools
244 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
clean
245 @
$(MAKE
) $(MKARGS
) -C
$(TOP
)/tools
/MetaMake
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
246 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/flexcat
/src
-f Makefile.aros
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
247 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/archtools
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
248 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/genmf
clean
249 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/dtdesc
-f Makefile.aros
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
250 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/collect-aros
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
251 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2inline
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
252 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2pragma
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
253 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/sfdc
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
254 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/setrev
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
255 -@
$(RM
) $(ARCHDIR
) Makefile config.cache config.status config.log \
256 mmake.cache mmake.config rom
/mmakefile config
/make.cfg \
257 $(AROS_DEVELOPMENT
)/include/aros
/config.h \
258 $(GENDIR
)/include/aros
/config.h
$(HOSTGENDIR
)/config
/host.cfg \
259 $(GENDIR
)/config
/target.cfg
$(GENDIR
)/config
/make.defaults \
260 $(GENDIR
)/config
/specs \
261 $(TOOLDIR
)/$(AROS_TARGET_CPU
)-$(AROS_TARGET_ARCH
)$(AROS_TARGET_SUFFIX
)-aros-gcc \
262 $(TOOLDIR
)/$(AROS_TARGET_CPU
)-$(AROS_TARGET_ARCH
)$(AROS_TARGET_SUFFIX
)-aros-ld \
263 $(GENDIR
)/scripts
/genshared
$(TOOLDIR
)/genmf.py \
264 tools
/adflib
/myconf.aros tools
/collect-aros
/env.h
266 # Clean the sources and tools
270 # Really clean all - like a clean checkout
271 dist-clean
: arch-clean
274 sdk-test
: parsesdkoffsets crosstools features
$(CONFIGUREFILES
)
275 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(GENDIR
)/tools
/parseoffsets SRCDIR
=$(SRCDIR
) TOP
=$(TOP
) test-sdk-headers-genfiles
277 # Don't try to generate $(TOP)/bin/$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)$(AROS_TARGET_SUFFIX)/gen/config/make.opts
278 $(TOP
)/bin
/$(AROS_TARGET_ARCH
)-$(AROS_TARGET_CPU
)$(AROS_TARGET_SUFFIX
)/gen
/config
/make.opts
:
281 # targets which do not generate files or for which a file/directory exists
282 .PHONY
: default
all makedirs tools crosstools features docs
clean arch-clean dist-clean
install \
283 $(TOP
)/bin
/$(AROS_TARGET_ARCH
)-$(AROS_TARGET_CPU
)$(AROS_TARGET_SUFFIX
)/gen
/config
/make.opts \
284 test kernel boot workbench compiler contrib ports sdk mmake query
286 # Workaround for bug in make v3.81 (should normally be handled by .DEFAULT)
287 install test kernel boot workbench compiler contrib ports sdk
: crosstools features
$(CONFIGUREFILES
)
288 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
290 # Bypass crosstools target.
292 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
294 # Map MetaTargets to make targets : Call mmake with AROS.target
295 # This does not allow to check for dependancies, so it is not suitable for
296 # Calling standard main targets, but is usable as a shortcut for MetaMake
297 # if it was not installed globally
301 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
303 # The '%-quick' and '%-clean' targets are special - we don't want to wait around
304 # for building crosstools if we just want to build one subtarget
306 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
308 .DEFAULT
: $(CONFIGUREFILES
)
309 @
$(MAKE
) $(MKARGS
) crosstools
310 @
$(MAKE
) $(MKARGS
) crosstools features
311 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@