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
25 MMAKE_OPTIONS ?
= --srcdir=$(SRCDIR
) --builddir
=$(TOP
)
26 ifneq (,$(findstring s
,$(MAKEFLAGS
)))
30 all: crosstools features
31 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.AROS
35 @
$(FOR
) dir in
$(AROSDIR
) $(GENDIR
) $(TOOLDIR
) ; do \
36 $(IF
) [ ! -d
$$dir ]; then \
37 $(MECHO
) $(MKDIR
) "$$dir" ; \
41 @
$(IF
) [ ! -f
$(AROSDIR
)/.gdbinit
]; then \
42 $(CP
) $(SRCDIR
)/_gdbinit
$(AROSDIR
)/.gdbinit
; \
45 # Create the tools that are used to build AROS.
46 tools
: makedirs mmake
$(TOOLLIB
) $(GENMF
) $(ARCHTOOL
) $(ELF2HUNK
) \
47 $(FLEXCAT
) $(CREATEDTDESC
) \
48 $(ILBMTOC
) $(ILBMTOICON
) $(INFOINFO
) \
49 $(COLLECT-AROS
) $(AFSLIB
) $(COPYTOAFS
) \
50 $(FD2INLINE
) $(FD2PRAGMA
) $(SFDC
) $(SETREV
)
53 ifneq ($(CROSSTOOLS_TARGET
),)
54 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$(CROSSTOOLS_TARGET
)
59 $(TOP
)/.features
: crosstools
$(SRCDIR
)/features
60 @
$(IF
) ! $(TEST
) -f
$@
; then \
61 @
$(ECHO
) "Querying target compiler features..." ; \
62 @cd
$(TOP
) ; 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
)/features
--host
=$(AROS_BUILD_HOST
) --with-config-dir
=$(GENDIR
)/config
; \
65 features
: $(TOP
)/.features
67 $(TOOLLIB
) : $(wildcard $(SRCDIR
)/tools
/toollib
/*.
[ch
])
68 @
$(ECHO
) Building toollib...
69 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/toollib SRCDIR
=$(SRCDIR
) TOP
=$(TOP
) CURDIR
=toollib
71 $(GENMF
) : $(SRCDIR
)/tools
/genmf
/genmf.py
72 @
$(ECHO
) Copying genmf...
73 @.
/config.status
$(subst $(TOP
)/,,$(GENMF
)) genmf_executable
75 $(ELF2HUNK
) : $(SRCDIR
)/tools
/elf2hunk
/elf2hunk.c
76 @
$(ECHO
) Building elf2hunk...
77 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/elf2hunk SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
79 $(ARCHTOOL
) : $(SRCDIR
)/tools
/archtools
/archtool.c
80 @
$(ECHO
) Building archtool...
81 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/archtools SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
83 $(FLEXCAT
) : $(wildcard $(SRCDIR
)/tools
/flexcat
/src
/*.
[ch
]) $(wildcard $(SRCDIR
)/tools
/flexcat
/src
/sd
/*.sd
)
84 @
$(ECHO
) Building flexcat...
85 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/flexcat
/src
-f Makefile.aros SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
87 $(CREATEDTDESC
) : $(wildcard $(SRCDIR
)/tools
/dtdesc
/*.
[ch
]) $(wildcard $(SRCDIR
)/tools
/dtdesc
/c_iff
/*.
[ch
])
88 @
$(ECHO
) Building createdtdesc...
89 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/dtdesc
-f Makefile.aros SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
91 $(AFSLIB
) : $(wildcard $(SRCDIR
)/workbench
/devs
/afs
/*.
[ch
])
92 @
$(ECHO
) Building afslib...
93 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/copytoafs
-f Makefile.afslib SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
95 $(COPYTOAFS
) : $(AFSLIB
) $(SRCDIR
)/tools
/copytoafs
/copytoafs.c
96 @
$(ECHO
) Building copytoafs...
97 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/copytoafs SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
99 $(ILBMTOC
) : $(SRCDIR
)/tools
/ilbmtoc
/ilbmtoc.c
100 @
$(ECHO
) Building ilbmtoc...
101 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/ilbmtoc SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
103 $(ILBMTOICON
) : $(SRCDIR
)/tools
/ilbmtoicon
/ilbmtoicon.c
104 @
$(ECHO
) Building ilbmtoicon...
105 @
$(CALL
) $(MAKE
) $(MKARGS
) $@
-C
$(SRCDIR
)/tools
/ilbmtoicon SRCDIR
=$(SRCDIR
) TOP
=$(TOP
) LIBPNG
=$(HOST_LIBPNG
)
107 $(INFOINFO
) : $(SRCDIR
)/tools
/ilbmtoicon
/infoinfo.c
108 @
$(ECHO
) Building infoinfo...
109 @
$(CALL
) $(MAKE
) $(MKARGS
) $@
-C
$(SRCDIR
)/tools
/ilbmtoicon SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
111 $(COLLECT-AROS
) : $(wildcard $(SRCDIR
)/tools
/collect-aros
/*.
[hc
])
112 @
$(ECHO
) Building collect-aros...
113 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/collect-aros SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
115 $(FD2INLINE
) : $(SRCDIR
)/tools
/fd2inline
/fd2inline.c
116 @
$(ECHO
) Building fd2inline...
117 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2inline SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
119 $(FD2PRAGMA
) : $(SRCDIR
)/tools
/fd2pragma
/fd2pragma.c
120 @
$(ECHO
) Building fd2pragma...
121 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2pragma SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
123 $(SFDC
) : $(SRCDIR
)/tools
/sfdc
/*.pl
124 @
$(ECHO
) Building sfdc...
125 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/sfdc SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
127 $(SETREV
) : $(SRCDIR
)/tools
/setrev
/setrev.c
128 @
$(ECHO
) Building setrev...
129 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/setrev SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
131 # MetaMake apparently requires a slighty different compilation. Probably
132 # because it is sort-of an external package as well.
134 mmake
: $(TOP
)/tools
/MetaMake
/Makefile
$(MMAKE
)
136 $(SRCDIR
)/tools
/MetaMake
/configure
: $(SRCDIR
)/tools
/MetaMake
/configure.in
137 @
$(ECHO
) Building MetaMake...
138 @cd
$(SRCDIR
)/tools
/MetaMake
&& @aros_host_aclocal@
&& @aros_host_autoconf@
140 $(TOP
)/tools
/MetaMake
/Makefile
: $(SRCDIR
)/tools
/MetaMake
/configure
$(SRCDIR
)/tools
/MetaMake
/Makefile.in
141 @
$(IF
) [ ! -d
$(TOP
)/tools
/MetaMake
]; then \
142 $(MECHO
) $(MKDIR
) "$(TOP)/tools/MetaMake" ; \
143 $(MKDIR
) "$(TOP)/tools/MetaMake"; \
145 @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
147 $(MMAKE
): $(TOP
)/tools
/MetaMake
/Makefile
$(wildcard $(SRCDIR
)/tools
/MetaMake
/*.
[ch
]) $(GENMF
)
148 @
$(MAKE
) $(MKARGS
) AUTOHEADER
=@aros_host_autoheader@
-C
$(TOP
)/tools
/MetaMake
149 @
$(MAKE
) $(MKARGS
) -C
$(TOP
)/tools
/MetaMake
install
151 # Clean the sources and tools
153 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
clean
154 @
$(MAKE
) $(MKARGS
) -C
$(TOP
)/tools
/MetaMake
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
155 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/flexcat
/src
-f Makefile.aros
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
156 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/archtools
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
157 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/genmf
clean
158 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/toollib
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
159 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/dtdesc
-f Makefile.aros
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
160 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/collect-aros
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
161 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2inline
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
162 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/fd2pragma
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
163 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/sfdc
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
164 @
$(CALL
) $(MAKE
) $(MKARGS
) -C
$(SRCDIR
)/tools
/setrev
clean SRCDIR
=$(SRCDIR
) TOP
=$(TOP
)
165 -@
$(RM
) $(ARCHDIR
) Makefile config.cache config.status config.log \
166 mmake.cache mmake.config rom
/mmakefile config
/make.cfg \
167 $(AROS_DEVELOPMENT
)/include/aros
/config.h \
168 $(GENDIR
)/include/aros
/config.h
$(HOSTGENDIR
)/config
/host.cfg \
169 $(GENDIR
)/config
/target.cfg
$(GENDIR
)/config
/make.defaults \
170 $(GENDIR
)/config
/specs \
171 $(TOOLDIR
)/$(AROS_TARGET_CPU
)-$(AROS_TARGET_ARCH
)$(AROS_TARGET_SUFFIX
)-aros-gcc \
172 $(TOOLDIR
)/$(AROS_TARGET_CPU
)-$(AROS_TARGET_ARCH
)$(AROS_TARGET_SUFFIX
)-aros-ld \
173 $(GENDIR
)/scripts
/genshared
$(TOOLDIR
)/genmf.py \
174 tools
/adflib
/myconf.aros tools
/collect-aros
/env.h
176 # Clean the sources and tools
180 # Really clean all - like a clean checkout
181 dist-clean
: arch-clean
184 # Don't try to generate $(TOP)/bin/$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)$(AROS_TARGET_SUFFIX)/gen/config/make.opts
185 $(TOP
)/bin
/$(AROS_TARGET_ARCH
)-$(AROS_TARGET_CPU
)$(AROS_TARGET_SUFFIX
)/gen
/config
/make.opts
:
188 # targets which do not generate files or for which a file/directory exists
189 .PHONY
: default
all makedirs tools crosstools features docs
clean arch-clean dist-clean
install \
190 $(TOP
)/bin
/$(AROS_TARGET_ARCH
)-$(AROS_TARGET_CPU
)$(AROS_TARGET_SUFFIX
)/gen
/config
/make.opts \
191 test kernel boot workbench compiler contrib ports sdk mmake query
193 # Workaround for bug in make v3.81 (should normally be handled by .DEFAULT)
194 install test kernel boot workbench compiler contrib ports sdk
: crosstools features
195 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
197 # Bypass crosstools target.
199 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
201 # Map MetaTargets to make targets : Call mmake with AROS.target
202 # This does not allow to check for dependancies, so it is not suitable for
203 # Calling standard main targets, but is usable as a shortcut for MetaMake
204 # if it was not installed globally
208 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
210 # The '%-quick' and '%-clean' targets are special - we don't want to wait around
211 # for building crosstools if we just want to build one subtarget
213 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@
216 @
$(MAKE
) $(MKARGS
) crosstools
217 @
$(MAKE
) $(MKARGS
) crosstools features
218 @
+$(CALL
) $(MMAKE
) $(MMAKE_OPTIONS
) AROS.
$@