Allow our own special C:SetPatch.
[AROS.git] / Makefile.in
blob7be3ae6065da90ed28b280f12ac214052ec2f308
1 # Copyright © 2000-2011, The AROS Development Team. All rights reserved.
2 # $Id$
4 # Main makefile for AROS
6 default: all
8 AROS_HOST_CPU ?= @aros_host_cpu@
9 AROS_HOST_ARCH ?= @aros_host_arch@
10 AROS_TARGET_CPU ?= @aros_target_cpu@
11 AROS_TARGET_ARCH ?= @aros_target_arch@
12 AROS_TARGET_VARIANT ?= @aros_target_variant@
14 # normally, these variable's should go in mmake.config/globalvarfile
15 export AROS_TARGET_BOOTLOADER := @aros_target_bootloader@
16 export AROS_TARGET_ICONSET := @aros_target_iconset@
17 export AROS_GUI_THEME := @aros_target_guitheme@
19 TOP := @AROS_BUILDDIR@
20 SRCDIR := @SRCDIR@
21 include $(TOP)/config/make.cfg
23 MMAKE_OPTIONS ?= --srcdir=$(SRCDIR) --builddir=$(TOP)
24 ifneq (,$(findstring s,$(MAKEFLAGS)))
25 MMAKE_OPTIONS += -q
26 endif
28 all: crosstools
29 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.AROS
31 makedirs:
32 @$(RM) $(TOP)/errors
33 @$(FOR) dir in $(AROSDIR) $(GENDIR) $(TOOLDIR) ; do \
34 $(IF) [ ! -d $$dir ]; then \
35 $(MECHO) $(MKDIR) "$$dir" ; \
36 $(MKDIR) "$$dir" ; \
37 else true ; fi ; \
38 done
39 @$(IF) [ ! -f $(AROSDIR)/.gdbinit ]; then \
40 $(CP) $(SRCDIR)/_gdbinit $(AROSDIR)/.gdbinit ; \
41 else true ; fi
43 # Create the tools that are used to build AROS.
44 tools : makedirs mmake $(TOOLLIB) $(GENMF) $(ARCHTOOL) $(ELF2HUNK) \
45 $(FLEXCAT) $(CREATEDTDESC) \
46 $(ILBMTOC) $(ILBMTOICON) $(INFOINFO) \
47 $(COLLECT-AROS) $(AFSLIB) $(COPYTOAFS) \
48 $(FD2INLINE) $(FD2PRAGMA) $(SFDC) $(SETREV)
50 crosstools : tools
51 ifneq ($(CROSSTOOLS_TARGET),)
52 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.$(CROSSTOOLS_TARGET)
53 else
54 @$(NOP)
55 endif
57 $(TOOLLIB) : $(wildcard $(SRCDIR)/tools/toollib/*.[ch])
58 @$(ECHO) Building toollib...
59 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/toollib SRCDIR=$(SRCDIR) TOP=$(TOP) CURDIR=toollib
61 $(GENMF) : $(SRCDIR)/tools/genmf/genmf.py
62 @$(ECHO) Copying genmf...
63 @./config.status $(subst $(TOP)/,,$(GENMF)) genmf_executable
65 $(ELF2HUNK) : $(SRCDIR)/tools/elf2hunk/elf2hunk.c
66 @$(ECHO) Building elf2hunk...
67 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/elf2hunk SRCDIR=$(SRCDIR) TOP=$(TOP)
69 $(ARCHTOOL) : $(SRCDIR)/tools/archtools/archtool.c
70 @$(ECHO) Building archtool...
71 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/archtools SRCDIR=$(SRCDIR) TOP=$(TOP)
73 $(FLEXCAT) : $(SRCDIR)/tools/FlexCat/flexcat.c
74 @$(ECHO) Building flexcat...
75 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/FlexCat SRCDIR=$(SRCDIR) TOP=$(TOP)
77 $(CREATEDTDESC) : $(wildcard $(SRCDIR)/tools/dtdesc/*.[ch]) $(wildcard $(SRCDIR)/tools/dtdesc/c_iff/*.[ch])
78 @$(ECHO) Building createdtdesc...
79 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/dtdesc -f Makefile.aros SRCDIR=$(SRCDIR) TOP=$(TOP)
81 $(AFSLIB) : $(wildcard $(SRCDIR)/workbench/devs/afs/*.[ch])
82 @$(ECHO) Building afslib...
83 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/copytoafs -f Makefile.afslib SRCDIR=$(SRCDIR) TOP=$(TOP)
85 $(COPYTOAFS) : $(AFSLIB) $(SRCDIR)/tools/copytoafs/copytoafs.c
86 @$(ECHO) Building copytoafs...
87 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/copytoafs SRCDIR=$(SRCDIR) TOP=$(TOP)
89 $(ILBMTOC) : $(SRCDIR)/tools/ilbmtoc/ilbmtoc.c
90 @$(ECHO) Building ilbmtoc...
91 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/ilbmtoc SRCDIR=$(SRCDIR) TOP=$(TOP)
93 $(ILBMTOICON) : $(SRCDIR)/tools/ilbmtoicon/ilbmtoicon.c
94 @$(ECHO) Building ilbmtoicon...
95 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/ilbmtoicon SRCDIR=$(SRCDIR) TOP=$(TOP)
97 $(INFOINFO) : $(SRCDIR)/tools/ilbmtoicon/infoinfo.c
98 @$(ECHO) Building infoinfo...
99 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/ilbmtoicon SRCDIR=$(SRCDIR) TOP=$(TOP)
101 $(COLLECT-AROS) : $(wildcard $(SRCDIR)/tools/collect-aros/*.[hc])
102 @$(ECHO) Building collect-aros...
103 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/collect-aros SRCDIR=$(SRCDIR) TOP=$(TOP)
105 $(FD2INLINE) : $(SRCDIR)/tools/fd2inline/fd2inline.c
106 @$(ECHO) Building fd2inline...
107 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/fd2inline SRCDIR=$(SRCDIR) TOP=$(TOP)
109 $(FD2PRAGMA) : $(SRCDIR)/tools/fd2pragma/fd2pragma.c
110 @$(ECHO) Building fd2pragma...
111 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/fd2pragma SRCDIR=$(SRCDIR) TOP=$(TOP)
113 $(SFDC) : $(SRCDIR)/tools/sfdc/*.pl
114 @$(ECHO) Building sfdc...
115 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/sfdc SRCDIR=$(SRCDIR) TOP=$(TOP)
117 $(SETREV) : $(SRCDIR)/tools/setrev/setrev.c
118 @$(ECHO) Building setrev...
119 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/setrev SRCDIR=$(SRCDIR) TOP=$(TOP)
121 # MetaMake apparently requires a slighty different compilation. Probably
122 # because it is sort-of an external package as well.
124 mmake : $(TOP)/tools/MetaMake/Makefile $(MMAKE)
126 $(SRCDIR)/tools/MetaMake/configure : $(SRCDIR)/tools/MetaMake/configure.in
127 @$(ECHO) Building MetaMake...
128 @cd $(SRCDIR)/tools/MetaMake && @aros_host_aclocal@ && @aros_host_autoconf@
130 $(TOP)/tools/MetaMake/Makefile : $(SRCDIR)/tools/MetaMake/configure $(SRCDIR)/tools/MetaMake/Makefile.in
131 @$(IF) [ ! -d $(TOP)/tools/MetaMake ]; then \
132 $(MECHO) $(MKDIR) "$(TOP)/tools/MetaMake" ; \
133 $(MKDIR) "$(TOP)/tools/MetaMake"; \
135 @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
137 $(MMAKE): $(TOP)/tools/MetaMake/Makefile $(wildcard $(SRCDIR)/tools/MetaMake/*.[ch]) $(GENMF)
138 @$(MAKE) $(MKARGS) AUTOHEADER=@aros_host_autoheader@ -C $(TOP)/tools/MetaMake
139 @$(MAKE) $(MKARGS) -C $(TOP)/tools/MetaMake install
141 # Clean the sources and tools
142 clean:
143 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.clean
144 @$(MAKE) $(MKARGS) -C $(TOP)/tools/MetaMake clean SRCDIR=$(SRCDIR) TOP=$(TOP)
145 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/FlexCat clean SRCDIR=$(SRCDIR) TOP=$(TOP)
146 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/archtools clean SRCDIR=$(SRCDIR) TOP=$(TOP)
147 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/genmf clean
148 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/toollib clean SRCDIR=$(SRCDIR) TOP=$(TOP)
149 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/dtdesc -f Makefile.aros clean SRCDIR=$(SRCDIR) TOP=$(TOP)
150 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/collect-aros clean SRCDIR=$(SRCDIR) TOP=$(TOP)
151 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/fd2inline clean SRCDIR=$(SRCDIR) TOP=$(TOP)
152 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/fd2pragma clean SRCDIR=$(SRCDIR) TOP=$(TOP)
153 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/sfdc clean SRCDIR=$(SRCDIR) TOP=$(TOP)
154 @$(CALL) $(MAKE) $(MKARGS) -C $(SRCDIR)/tools/setrev clean SRCDIR=$(SRCDIR) TOP=$(TOP)
155 -@$(RM) $(ARCHDIR) Makefile config.cache config.status config.log \
156 mmake.cache mmake.config rom/mmakefile config/make.cfg \
157 $(AROS_DEVELOPMENT)/include/aros/config.h \
158 $(GENDIR)/include/aros/config.h $(HOSTGENDIR)/config/host.cfg \
159 $(GENDIR)/config/target.cfg $(GENDIR)/config/make.defaults \
160 $(GENDIR)/config/specs \
161 $(TOOLDIR)/$(AROS_TARGET_CPU)-$(AROS_TARGET_ARCH)$(AROS_TARGET_SUFFIX)-aros-gcc \
162 $(TOOLDIR)/$(AROS_TARGET_CPU)-$(AROS_TARGET_ARCH)$(AROS_TARGET_SUFFIX)-aros-ld \
163 $(GENDIR)/scripts/genshared $(TOOLDIR)/genmf.py \
164 tools/adflib/myconf.aros tools/collect-aros/env.h
166 # Clean the sources and tools
167 arch-clean: clean
168 @$(NOP)
170 # Really clean all - like a clean checkout
171 dist-clean: arch-clean
172 @$(NOP)
174 # Dependencies don't work with .DEFAULT :-(
175 docs : tools
176 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.docs
178 all-docs : tools
179 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.all-docs
181 # Don't try to generate $(TOP)/bin/$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)$(AROS_TARGET_SUFFIX)/gen/config/make.opts
182 $(TOP)/bin/$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)$(AROS_TARGET_SUFFIX)/gen/config/make.opts:
183 @$(NOP)
185 # targets which do not generate files or for which a file/directory exists
186 .PHONY: default all makedirs tools crosstools docs clean arch-clean dist-clean install \
187 $(TOP)/bin/$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)$(AROS_TARGET_SUFFIX)/gen/config/make.opts \
188 test kernel boot workbench compiler contrib sdk mmake query
190 # Workaround for bug in make v3.81 (should normally be handled by .DEFAULT)
191 install test kernel boot workbench compiler contrib sdk : crosstools
192 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.$@
194 # Bypass crosstools target.
195 query : tools
196 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.$@
198 # Map MetaTargets to make targets : Call mmake with AROS.target
199 # This does not allow to check for dependancies, so it is not suitable for
200 # Calling standard main targets, but is usable as a shortcut for MetaMake
201 # if it was not installed globally
203 # The '%-quick:' targets are special - we don't want to wait around
204 # for building crosstools if we just want to build one subtarget
205 %-quick:
206 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.$@
208 .DEFAULT :
209 @$(MAKE) $(MKARGS) crosstools
210 @+$(CALL) $(MMAKE) $(MMAKE_OPTIONS) AROS.$@