1 # Copyright © 2000-2016, 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 # normally, these variable's should go in mmake.config/globalvarfile
17 export AROS_TARGET_BOOTLOADER
:= @aros_target_bootloader@
18 export AROS_TARGET_ICONSET
:= @aros_target_iconset@
19 export AROS_GUI_THEME
:= @aros_target_guitheme@
21 TOP
:= @AROS_BUILDDIR@
23 include $(TOP
)/config
/make.cfg
24 ifneq ($(CROSSTOOLS_TARGET
),)
25 include $(SRCDIR
)/tools
/crosstools
/$(AROS_TOOLCHAIN
).cfg
26 include $(SRCDIR
)/tools
/crosstools
/$(AROS_TOOLCHAIN
).deps
27 CROSSTOOLS_BUILDFLAG
:=$(CROSSTOOLSDIR
)/.installflag-crosstools
28 AROS_TOOLCHAIN_DEPS
:=$(AROS_TOOLCHAIN_DEPS
) $(SRCDIR
)/tools
/crosstools
/$(AROS_TOOLCHAIN
).cfg
$(SRCDIR
)/tools
/crosstools
/$(AROS_TOOLCHAIN
).deps
$(SRCDIR
)/tools
/crosstools
/mmakefile.src
30 CROSSTOOLS_BUILDFLAG
:=
33 MMAKE_OPTIONS ?
= --srcdir=$(SRCDIR
) --builddir
=$(TOP
)
34 ifneq (,$(findstring s
,$(MAKEFLAGS
)))
39 # Rules for Configure generated files ...
42 $(TOP
)/config
/make.cfg
: $(SRCDIR
)/config
/make.cfg.in
$(TOP
)/config.status
43 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
44 $(TOP
)/config.status
--silent
--file
=$@
:$<
46 CONFIGUREFILES
+= $(TOP
)/config
/make.cfg
48 $(TOP
)/compiler
/include/geninc.cfg
: $(SRCDIR
)/compiler
/include/geninc.cfg.in
$(TOP
)/config.status
49 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
50 $(TOP
)/config.status
--silent
--file
=$@
:$<
52 CONFIGUREFILES
+= $(TOP
)/compiler
/include/geninc.cfg
54 $(AROS_INCLUDES
)/aros
/config.h
: $(SRCDIR
)/config
/config.h.in
$(TOP
)/config.status
55 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
56 $(TOP
)/config.status
--silent
--file
=$@
:$<
58 CONFIGUREFILES
+= $(AROS_INCLUDES
)/aros
/config.h
60 $(GENINCDIR
)/aros
/config.h
: $(SRCDIR
)/config
/config.h.in
$(TOP
)/config.status
61 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
62 $(TOP
)/config.status
--silent
--file
=$@
:$<
64 CONFIGUREFILES
+= $(GENINCDIR
)/aros
/config.h
66 $(GENDIR
)/config
/target.cfg
: $(SRCDIR
)/config
/target.cfg.in
$(TOP
)/config.status
67 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
68 $(TOP
)/config.status
--silent
--file
=$@
:$<
70 CONFIGUREFILES
+= $(GENDIR
)/config
/target.cfg
72 $(GENDIR
)/config
/build.cfg
: $(SRCDIR
)/config
/build.cfg.in
$(TOP
)/config.status
73 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
74 $(TOP
)/config.status
--silent
--file
=$@
:$<
76 CONFIGUREFILES
+= $(GENDIR
)/config
/build.cfg
78 $(GENDIR
)/config
/make.defaults
: $(SRCDIR
)/config
/make.defaults.in
$(TOP
)/config.status
79 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
80 $(TOP
)/config.status
--silent
--file
=$@
:$<
82 CONFIGUREFILES
+= $(GENDIR
)/config
/make.defaults
84 $(HOSTGENDIR
)/config
/host.cfg
: $(SRCDIR
)/config
/host.cfg.in
$(TOP
)/config.status
85 @
+$(ECHO
) "Regenerating " $(subst $(TOP
)/,,$@
); \
86 $(TOP
)/config.status
--silent
--file
=$@
:$<
88 CONFIGUREFILES
+= $(HOSTGENDIR
)/config
/host.cfg
94 all: $(CONFIGUREFILES
) crosstools features
95 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.AROS
99 @
$(FOR
) dir in
$(AROSDIR
) $(GENDIR
) $(TOOLDIR
) ; do \
100 $(IF
) [ ! -d
$$dir ]; then \
101 $(MECHO
) $(MKDIR
) "$$dir" ; \
105 @
$(IF
) [ ! -f
$(AROSDIR
)/.gdbinit
]; then \
106 $(CP
) $(SRCDIR
)/_gdbinit
$(AROSDIR
)/.gdbinit
; \
109 # Create the tools that are used to build AROS.
110 tools
: makedirs mmake
$(GENMF
) $(ARCHTOOL
) $(ELF2HUNK
) \
111 $(FLEXCAT
) $(CREATEDTDESC
) \
112 $(ILBMTOC
) $(ILBMTOICON
) $(INFOINFO
) \
113 $(COLLECT-AROS
) $(AFSLIB
) $(COPYTOAFS
) \
114 $(FD2INLINE
) $(FD2PRAGMA
) $(SFDC
) $(SETREV
)
117 # rebuild the crosstools if we are reconfigured, or its dependencies change.
118 $(CROSSTOOLSDIR
)/.installflag-crosstools
: $(TOP
)/config.status
$(AROS_TOOLCHAIN_DEPS
) tools
119 @
+$(IF
) ! $(TEST
) -f
$@
; then \
120 $(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$(CROSSTOOLS_TARGET
) && $(TOUCH
) $@
; \
123 crosstools
: tools
$(CROSSTOOLS_BUILDFLAG
)
126 $(TOP
)/config
/features.status
: $(SRCDIR
)/config
/features
$(CROSSTOOLS_BUILDFLAG
)
127 @
$(IF
) ! $(TEST
) -f
$@
; then \
128 $(ECHO
) "Querying target compiler features..." ; \
129 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
; \
132 features
: crosstools
$(TOP
)/config
/features.status
135 $(GENMF
): $(SRCDIR
)/tools
/genmf
/genmf.py
136 @
$(ECHO
) Copying genmf...
137 @.
/config.status
$(subst $(TOP
)/,,$(GENMF
)) genmf_executable
139 $(ELF2HUNK
): $(SRCDIR
)/tools
/elf2hunk
/elf2hunk.c
140 @
$(ECHO
) Building elf2hunk...
141 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/elf2hunk SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
143 $(ARCHTOOL
): $(SRCDIR
)/tools
/archtools
/archtool.c
144 @
$(ECHO
) Building archtool...
145 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/archtools SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
147 $(FLEXCAT
): $(wildcard $(SRCDIR
)/tools
/flexcat
/src
/*.
[ch
]) $(wildcard $(SRCDIR
)/tools
/flexcat
/src
/sd
/*.sd
)
148 @
$(ECHO
) Building flexcat...
149 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/flexcat
/src
-f Makefile.aros SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
151 $(CREATEDTDESC
): $(wildcard $(SRCDIR
)/tools
/dtdesc
/*.
[ch
]) $(wildcard $(SRCDIR
)/tools
/dtdesc
/c_iff
/*.
[ch
])
152 @
$(ECHO
) Building createdtdesc...
153 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/dtdesc
-f Makefile.aros SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
155 $(AFSLIB
): $(wildcard $(SRCDIR
)/workbench
/devs
/afs
/*.
[ch
])
156 @
$(ECHO
) Building afslib...
157 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/copytoafs
-f Makefile.afslib SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
159 $(COPYTOAFS
): $(AFSLIB
) $(SRCDIR
)/tools
/copytoafs
/copytoafs.c
160 @
$(ECHO
) Building copytoafs...
161 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/copytoafs SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
163 $(ILBMTOC
): $(SRCDIR
)/tools
/ilbmtoc
/ilbmtoc.c
164 @
$(ECHO
) Building ilbmtoc...
165 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/ilbmtoc SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
167 $(ILBMTOICON
): $(SRCDIR
)/tools
/ilbmtoicon
/ilbmtoicon.c
168 @
$(ECHO
) Building ilbmtoicon...
169 @
$(CALL
) $(MAKE
) $(MKARGS
) $@
-C
$(SRCDIR
)/tools
/ilbmtoicon SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
171 $(INFOINFO
): $(SRCDIR
)/tools
/ilbmtoicon
/infoinfo.c
172 @
$(ECHO
) Building infoinfo...
173 @
$(CALL
) $(MAKE
) $(MKARGS
) $@
-C
$(SRCDIR
)/tools
/ilbmtoicon SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
175 $(COLLECT-AROS
): $(wildcard $(SRCDIR
)/tools
/collect-aros
/*.
[hc
])
176 @
$(ECHO
) Building collect-aros...
177 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/collect-aros SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
179 $(FD2INLINE
): $(SRCDIR
)/tools
/fd2inline
/fd2inline.c
180 @
$(ECHO
) Building fd2inline...
181 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2inline SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
183 $(FD2PRAGMA
): $(SRCDIR
)/tools
/fd2pragma
/fd2pragma.c
184 @
$(ECHO
) Building fd2pragma...
185 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2pragma SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
187 $(SFDC
): $(SRCDIR
)/tools
/sfdc
/*.pl
188 @
$(ECHO
) Building sfdc...
189 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/sfdc SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
191 $(SETREV
): $(SRCDIR
)/tools
/setrev
/setrev.c
192 @
$(ECHO
) Building setrev...
193 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/setrev SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
195 # MetaMake apparently requires a slighty different compilation. Probably
196 # because it is sort-of an external package as well.
198 mmake
: $(TOP
)/tools
/MetaMake
/Makefile
$(MMAKE
)
201 $(SRCDIR
)/tools
/MetaMake
/configure
: $(SRCDIR
)/tools
/MetaMake
/configure.in
202 @
$(ECHO
) Building MetaMake...
203 @cd
$(SRCDIR
)/tools
/MetaMake
&& @aros_host_aclocal@
&& @aros_host_autoconf@
205 $(TOP
)/tools
/MetaMake
/Makefile
: $(SRCDIR
)/tools
/MetaMake
/configure
$(SRCDIR
)/tools
/MetaMake
/Makefile.in
206 @
$(IF
) [ ! -d
$(TOP
)/tools
/MetaMake
]; then \
207 $(MECHO
) $(MKDIR
) "$(TOP)/tools/MetaMake" ; \
208 $(MKDIR
) "$(TOP)/tools/MetaMake"; \
210 @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
212 $(MMAKE
): $(TOP
)/tools
/MetaMake
/Makefile
$(wildcard $(SRCDIR
)/tools
/MetaMake
/*.
[ch
]) $(GENMF
)
213 @
$(MAKE
) $(MKARGS
) AUTOHEADER
=@aros_host_autoheader@
-C
$(TOP
)/tools
/MetaMake
214 @
$(MAKE
) $(MKARGS
) -C
$(TOP
)/tools
/MetaMake
install
216 # Clean the sources and tools
218 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
clean
219 @
$(MAKE
) $(MKARGS
) -C
$(TOP
)/tools
/MetaMake
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
220 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/flexcat
/src
-f Makefile.aros
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
221 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/archtools
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
222 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/genmf
clean
223 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/dtdesc
-f Makefile.aros
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
224 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/collect-aros
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
225 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2inline
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
226 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2pragma
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
227 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/sfdc
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
228 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/setrev
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
229 -@
$(RM
) $(ARCHDIR
) Makefile config.cache config.status config.log \
230 mmake.cache mmake.config rom
/mmakefile config
/make.cfg \
231 $(AROS_DEVELOPMENT
)/include/aros
/config.h \
232 $(GENDIR
)/include/aros
/config.h
$(HOSTGENDIR
)/config
/host.cfg \
233 $(GENDIR
)/config
/target.cfg
$(GENDIR
)/config
/make.defaults \
234 $(GENDIR
)/config
/specs \
235 $(TOOLDIR
)/$(AROS_TARGET_CPU
)-$(AROS_TARGET_ARCH
)$(AROS_TARGET_SUFFIX
)-aros-gcc \
236 $(TOOLDIR
)/$(AROS_TARGET_CPU
)-$(AROS_TARGET_ARCH
)$(AROS_TARGET_SUFFIX
)-aros-ld \
237 $(GENDIR
)/scripts
/genshared
$(TOOLDIR
)/genmf.py \
238 tools
/adflib
/myconf.aros tools
/collect-aros
/env.h
240 # Clean the sources and tools
244 # Really clean all - like a clean checkout
245 dist-clean
: arch-clean
248 # Don't try to generate $(TOP)/bin/$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)$(AROS_TARGET_SUFFIX)/gen/config/make.opts
249 $(TOP
)/bin
/$(AROS_TARGET_ARCH
)-$(AROS_TARGET_CPU
)$(AROS_TARGET_SUFFIX
)/gen
/config
/make.opts
:
252 # targets which do not generate files or for which a file/directory exists
253 .PHONY
: default
all makedirs tools crosstools features docs
clean arch-clean dist-clean
install \
254 $(TOP
)/bin
/$(AROS_TARGET_ARCH
)-$(AROS_TARGET_CPU
)$(AROS_TARGET_SUFFIX
)/gen
/config
/make.opts \
255 test kernel boot workbench compiler contrib ports sdk mmake query
257 # Workaround for bug in make v3.81 (should normally be handled by .DEFAULT)
258 install test kernel boot workbench compiler contrib ports sdk
: crosstools features
$(CONFIGUREFILES
)
259 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
261 # Bypass crosstools target.
263 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
265 # Map MetaTargets to make targets : Call mmake with AROS.target
266 # This does not allow to check for dependancies, so it is not suitable for
267 # Calling standard main targets, but is usable as a shortcut for MetaMake
268 # if it was not installed globally
272 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
274 # The '%-quick' and '%-clean' targets are special - we don't want to wait around
275 # for building crosstools if we just want to build one subtarget
277 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
279 .DEFAULT
: $(CONFIGUREFILES
)
280 @
$(MAKE
) $(MKARGS
) crosstools
281 @
$(MAKE
) $(MKARGS
) crosstools features
282 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@