don't define HW_IRQ_COUNT if its already provided. if HW_IRQ_BASE is defined, take...
[AROS.git] / Makefile.in
blobe8c627ba7029d254ace1f1ab27c92601800315e5
1 # Copyright © 2000-2016, The AROS Development Team. All rights reserved.
2 # $Id$
4 # Main makefile for AROS
6 default: all
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@
22 SRCDIR := @SRCDIR@
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
29 else
30 CROSSTOOLS_BUILDFLAG:=
31 endif
33 MMAKE_OPTIONS ?= --srcdir=$(SRCDIR) --builddir=$(TOP)
34 ifneq (,$(findstring s,$(MAKEFLAGS)))
35 MMAKE_OPTIONS += -q
36 endif
38 all: crosstools features
39 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.AROS
41 makedirs:
42 @$(RM) $(TOP)/errors
43 @$(FOR) dir in $(AROSDIR) $(GENDIR) $(TOOLDIR) ; do \
44 $(IF) [ ! -d $$dir ]; then \
45 $(MECHO) $(MKDIR) "$$dir" ; \
46 $(MKDIR) "$$dir" ; \
47 else true ; fi ; \
48 done
49 @$(IF) [ ! -f $(AROSDIR)/.gdbinit ]; then \
50 $(CP) $(SRCDIR)/_gdbinit $(AROSDIR)/.gdbinit ; \
51 else true ; fi
53 # Create the tools that are used to build AROS.
54 tools : makedirs mmake $(GENMF) $(ARCHTOOL) $(ELF2HUNK) \
55 $(FLEXCAT) $(CREATEDTDESC) \
56 $(ILBMTOC) $(ILBMTOICON) $(INFOINFO) \
57 $(COLLECT-AROS) $(AFSLIB) $(COPYTOAFS) \
58 $(FD2INLINE) $(FD2PRAGMA) $(SFDC) $(SETREV)
59 @$(NOP)
61 # rebuild the crosstools if we are reconfigured, or its dependencies change.
62 $(CROSSTOOLSDIR)/.installflag-crosstools : $(TOP)/config.status $(AROS_TOOLCHAIN_DEPS) tools
63 @+$(IF) ! $(TEST) -f $@ ; then \
64 $(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.$(CROSSTOOLS_TARGET) && $(TOUCH) $@ ; \
67 crosstools : tools $(CROSSTOOLS_BUILDFLAG)
68 @$(NOP)
70 $(TOP)/config/features.status : $(SRCDIR)/config/features $(CROSSTOOLS_BUILDFLAG)
71 @$(IF) ! $(TEST) -f $@ ; then \
72 $(ECHO) "Querying target compiler features..." ; \
73 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 ; \
76 features : crosstools $(TOP)/config/features.status
77 @$(NOP)
79 $(GENMF) : $(SRCDIR)/tools/genmf/genmf.py
80 @$(ECHO) Copying genmf...
81 @./config.status $(subst $(TOP)/,,$(GENMF)) genmf_executable
83 $(ELF2HUNK) : $(SRCDIR)/tools/elf2hunk/elf2hunk.c
84 @$(ECHO) Building elf2hunk...
85 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/elf2hunk SRCDIR=$(SRCDIR) TOP=$(TOP)
87 $(ARCHTOOL) : $(SRCDIR)/tools/archtools/archtool.c
88 @$(ECHO) Building archtool...
89 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/archtools SRCDIR=$(SRCDIR) TOP=$(TOP)
91 $(FLEXCAT) : $(wildcard $(SRCDIR)/tools/flexcat/src/*.[ch]) $(wildcard $(SRCDIR)/tools/flexcat/src/sd/*.sd)
92 @$(ECHO) Building flexcat...
93 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/flexcat/src -f Makefile.aros SRCDIR=$(SRCDIR) TOP=$(TOP)
95 $(CREATEDTDESC) : $(wildcard $(SRCDIR)/tools/dtdesc/*.[ch]) $(wildcard $(SRCDIR)/tools/dtdesc/c_iff/*.[ch])
96 @$(ECHO) Building createdtdesc...
97 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/dtdesc -f Makefile.aros SRCDIR=$(SRCDIR) TOP=$(TOP)
99 $(AFSLIB) : $(wildcard $(SRCDIR)/workbench/devs/afs/*.[ch])
100 @$(ECHO) Building afslib...
101 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/copytoafs -f Makefile.afslib SRCDIR=$(SRCDIR) TOP=$(TOP)
103 $(COPYTOAFS) : $(AFSLIB) $(SRCDIR)/tools/copytoafs/copytoafs.c
104 @$(ECHO) Building copytoafs...
105 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/copytoafs SRCDIR=$(SRCDIR) TOP=$(TOP)
107 $(ILBMTOC) : $(SRCDIR)/tools/ilbmtoc/ilbmtoc.c
108 @$(ECHO) Building ilbmtoc...
109 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/ilbmtoc SRCDIR=$(SRCDIR) TOP=$(TOP)
111 $(ILBMTOICON) : $(SRCDIR)/tools/ilbmtoicon/ilbmtoicon.c
112 @$(ECHO) Building ilbmtoicon...
113 @$(CALL) $(MAKE) $(MKARGS) $@ -C $(SRCDIR)/tools/ilbmtoicon SRCDIR=$(SRCDIR) TOP=$(TOP)
115 $(INFOINFO) : $(SRCDIR)/tools/ilbmtoicon/infoinfo.c
116 @$(ECHO) Building infoinfo...
117 @$(CALL) $(MAKE) $(MKARGS) $@ -C $(SRCDIR)/tools/ilbmtoicon SRCDIR=$(SRCDIR) TOP=$(TOP)
119 $(COLLECT-AROS) : $(wildcard $(SRCDIR)/tools/collect-aros/*.[hc])
120 @$(ECHO) Building collect-aros...
121 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/collect-aros SRCDIR=$(SRCDIR) TOP=$(TOP)
123 $(FD2INLINE) : $(SRCDIR)/tools/fd2inline/fd2inline.c
124 @$(ECHO) Building fd2inline...
125 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/fd2inline SRCDIR=$(SRCDIR) TOP=$(TOP)
127 $(FD2PRAGMA) : $(SRCDIR)/tools/fd2pragma/fd2pragma.c
128 @$(ECHO) Building fd2pragma...
129 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/fd2pragma SRCDIR=$(SRCDIR) TOP=$(TOP)
131 $(SFDC) : $(SRCDIR)/tools/sfdc/*.pl
132 @$(ECHO) Building sfdc...
133 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/sfdc SRCDIR=$(SRCDIR) TOP=$(TOP)
135 $(SETREV) : $(SRCDIR)/tools/setrev/setrev.c
136 @$(ECHO) Building setrev...
137 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/setrev SRCDIR=$(SRCDIR) TOP=$(TOP)
139 # MetaMake apparently requires a slighty different compilation. Probably
140 # because it is sort-of an external package as well.
142 mmake : $(TOP)/tools/MetaMake/Makefile $(MMAKE)
143 @$(NOP)
145 $(SRCDIR)/tools/MetaMake/configure : $(SRCDIR)/tools/MetaMake/configure.in
146 @$(ECHO) Building MetaMake...
147 @cd $(SRCDIR)/tools/MetaMake && @aros_host_aclocal@ && @aros_host_autoconf@
149 $(TOP)/tools/MetaMake/Makefile : $(SRCDIR)/tools/MetaMake/configure $(SRCDIR)/tools/MetaMake/Makefile.in
150 @$(IF) [ ! -d $(TOP)/tools/MetaMake ]; then \
151 $(MECHO) $(MKDIR) "$(TOP)/tools/MetaMake" ; \
152 $(MKDIR) "$(TOP)/tools/MetaMake"; \
154 @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
156 $(MMAKE): $(TOP)/tools/MetaMake/Makefile $(wildcard $(SRCDIR)/tools/MetaMake/*.[ch]) $(GENMF)
157 @$(MAKE) $(MKARGS) AUTOHEADER=@aros_host_autoheader@ -C $(TOP)/tools/MetaMake
158 @$(MAKE) $(MKARGS) -C $(TOP)/tools/MetaMake install
160 # Clean the sources and tools
161 clean:
162 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.clean
163 @$(MAKE) $(MKARGS) -C $(TOP)/tools/MetaMake clean SRCDIR=$(SRCDIR) TOP=$(TOP)
164 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/flexcat/src -f Makefile.aros clean SRCDIR=$(SRCDIR) TOP=$(TOP)
165 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/archtools clean SRCDIR=$(SRCDIR) TOP=$(TOP)
166 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/genmf clean
167 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/dtdesc -f Makefile.aros clean SRCDIR=$(SRCDIR) TOP=$(TOP)
168 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/collect-aros clean SRCDIR=$(SRCDIR) TOP=$(TOP)
169 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/fd2inline clean SRCDIR=$(SRCDIR) TOP=$(TOP)
170 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/fd2pragma clean SRCDIR=$(SRCDIR) TOP=$(TOP)
171 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/sfdc clean SRCDIR=$(SRCDIR) TOP=$(TOP)
172 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/setrev clean SRCDIR=$(SRCDIR) TOP=$(TOP)
173 -@$(RM) $(ARCHDIR) Makefile config.cache config.status config.log \
174 mmake.cache mmake.config rom/mmakefile config/make.cfg \
175 $(AROS_DEVELOPMENT)/include/aros/config.h \
176 $(GENDIR)/include/aros/config.h $(HOSTGENDIR)/config/host.cfg \
177 $(GENDIR)/config/target.cfg $(GENDIR)/config/make.defaults \
178 $(GENDIR)/config/specs \
179 $(TOOLDIR)/$(AROS_TARGET_CPU)-$(AROS_TARGET_ARCH)$(AROS_TARGET_SUFFIX)-aros-gcc \
180 $(TOOLDIR)/$(AROS_TARGET_CPU)-$(AROS_TARGET_ARCH)$(AROS_TARGET_SUFFIX)-aros-ld \
181 $(GENDIR)/scripts/genshared $(TOOLDIR)/genmf.py \
182 tools/adflib/myconf.aros tools/collect-aros/env.h
184 # Clean the sources and tools
185 arch-clean: clean
186 @$(NOP)
188 # Really clean all - like a clean checkout
189 dist-clean: arch-clean
190 @$(NOP)
192 # Don't try to generate $(TOP)/bin/$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)$(AROS_TARGET_SUFFIX)/gen/config/make.opts
193 $(TOP)/bin/$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)$(AROS_TARGET_SUFFIX)/gen/config/make.opts:
194 @$(NOP)
196 # targets which do not generate files or for which a file/directory exists
197 .PHONY: default all makedirs tools crosstools features docs clean arch-clean dist-clean install \
198 $(TOP)/bin/$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)$(AROS_TARGET_SUFFIX)/gen/config/make.opts \
199 test kernel boot workbench compiler contrib ports sdk mmake query
201 # Workaround for bug in make v3.81 (should normally be handled by .DEFAULT)
202 install test kernel boot workbench compiler contrib ports sdk : crosstools features
203 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.$@
205 # Bypass crosstools target.
206 query : tools
207 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.$@
209 # Map MetaTargets to make targets : Call mmake with AROS.target
210 # This does not allow to check for dependancies, so it is not suitable for
211 # Calling standard main targets, but is usable as a shortcut for MetaMake
212 # if it was not installed globally
215 distfiles::
216 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.$@
218 # The '%-quick' and '%-clean' targets are special - we don't want to wait around
219 # for building crosstools if we just want to build one subtarget
220 %-quick %-clean:
221 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.$@
223 .DEFAULT :
224 @$(MAKE) $(MKARGS) crosstools
225 @$(MAKE) $(MKARGS) crosstools features
226 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.$@