1 # Copyright © 1995-2011, The AROS Development Team. All rights reserved.
4 # Static makefile rule file for AROS.
6 ifneq ($(AROS_TARGET_VARIANT),)
7 AROS_TARGET_SUFFIX=-$(AROS_TARGET_VARIANT)
8 ifeq ($(AROS_TARGET_ARCH),pc)
9 # 'pc' target has 'tiny' variant for boot floppy, which affects only GRUB options.
10 # It should not affect AROS_TARGET_PLATFORM
11 AROS_TARGET_PLATFORM := $(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)
13 AROS_TARGET_PLATFORM := $(AROS_TARGET_VARIANT)-$(AROS_TARGET_CPU)
17 AROS_TARGET_PLATFORM := $(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)
20 # All files corresponding to a specific host go here.
21 HOSTDIR := $(TOP)/bin/$(AROS_HOST_ARCH)-$(AROS_HOST_CPU)
22 TOOLDIR := $(HOSTDIR)/tools
24 HOSTGENDIR := $(HOSTDIR)/gen
26 # All files corresponding to a specific target go here.
27 TARGETDIR := $(TOP)/bin/$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)$(AROS_TARGET_SUFFIX)
29 GENDIR := $(TARGETDIR)/gen
31 -include $(GENDIR)/config/make.defaults
32 -include $(GENDIR)/config/make.opts
34 # target.cfg *must* come before host.cfg
35 include $(GENDIR)/config/target.cfg
36 include $(HOSTGENDIR)/config/host.cfg
38 # Cross tools installation directory.
39 CROSSTOOLSDIR := @AROS_CROSSTOOLSDIR@
41 # Files downloaded from the net are put here
42 PORTSSOURCEDIR := @AROS_PORTSSRCDIR@
43 PORTSDIR := $(TARGETDIR)/Ports
45 # Distributable Files we generate are put here
46 DISTDIR := @AROS_BUILDDIR_UNIX@/distfiles
48 # File for AROS gcc cross compiler spec file
49 SPECS := $(GENDIR)/config/specs
51 # This is the directory structure for an AROS system.
52 AROSDIR := $(TARGETDIR)/AROS
54 # Relative paths for standard directories
57 AROS_DIR_CLASSES := Classes
58 AROS_DIR_DATATYPES := $(AROS_DIR_CLASSES)/Datatypes
59 AROS_DIR_GADGETS := $(AROS_DIR_CLASSES)/Gadgets
61 AROS_DIR_EXPANSION := Expansion
63 AROS_DIR_LIBRARIES := Libs
64 AROS_DIR_LOCALE := Locale
66 AROS_DIR_DEVELOPMENT := Development
67 AROS_DIR_INCLUDE := $(AROS_DIR_DEVELOPMENT)/include
68 AROS_DIR_LIB := $(AROS_DIR_DEVELOPMENT)/lib
69 AROS_DIR_CONTRIB := Extras
70 AROS_DIR_ARCH := boot/$(AROS_TARGET_ARCH)$(AROS_TARGET_SUFFIX)
72 # Absolute paths for standard directories
73 AROSARCHDIR := $(AROSDIR)/$(AROS_DIR_ARCH)
74 AROS_BOOT := $(AROSDIR)/$(AROS_DIR_BOOT)
75 AROS_C := $(AROSDIR)/$(AROS_DIR_C)
76 AROS_CLASSES := $(AROSDIR)/$(AROS_DIR_CLASSES)
77 AROS_CLASSES_ARCH := $(AROSDIR)/$(AROS_DIR_ARCH)/$(AROS_DIR_CLASSES)
78 AROS_DATATYPES := $(AROSDIR)/$(AROS_DIR_DATATYPES)
79 AROS_GADGETS := $(AROSDIR)/$(AROS_DIR_GADGETS)
80 AROS_DEVS := $(AROSDIR)/$(AROS_DIR_DEVS)
81 AROS_DEVS_ARCH := $(AROSDIR)/$(AROS_DIR_ARCH)/$(AROS_DIR_DEVS)
82 AROS_EXPANSION := $(AROSDIR)/$(AROS_DIR_EXPANSION)
83 AROS_FS := $(AROSDIR)/$(AROS_DIR_FS)
84 AROS_FS_ARCH := $(AROSDIR)/$(AROS_DIR_ARCH)/$(AROS_DIR_FS)
85 AROS_RESOURCES := $(AROS_DEVS)
86 AROS_DRIVERS := $(AROS_DEVS)/Drivers
87 AROS_LIBRARIES := $(AROSDIR)/$(AROS_DIR_LIBRARIES)
88 AROS_LIBRARIES_ARCH := $(AROSDIR)/$(AROS_DIR_ARCH)/$(AROS_DIR_LIBRARIES)
89 AROS_LOCALE := $(AROSDIR)/$(AROS_DIR_LOCALE)
90 AROS_CATALOGS := $(AROS_LOCALE)/Catalogs
91 AROS_HELP := $(AROS_LOCALE)/Help
92 AROS_PREFS := $(AROSDIR)/Prefs
93 AROS_ENVARC := $(AROS_PREFS)/Env-Archive
94 AROS_PACKAGES := $(AROS_ENVARC)/SYS/Packages
95 AROS_PRINTERS := $(AROS_DEVS)/Printers
96 AROS_S := $(AROSDIR)/$(AROS_DIR_S)
97 AROS_SYSTEM := $(AROSDIR)/System
98 AROS_WANDERER := $(AROS_SYSTEM)/Wanderer
99 AROS_THEMES := $(AROS_PREFS)/Presets/Themes
100 AROS_IMAGES := $(AROS_SYSTEM)/Images
101 AROS_TOOLS := $(AROSDIR)/Tools
102 AROS_UTILITIES := $(AROSDIR)/Utilities
103 AROS_TESTS := $(AROSDIR)/Tests
105 AROS_DEVELOPMENT := $(AROSDIR)/$(AROS_DIR_DEVELOPMENT)
106 AROS_INCLUDES := $(AROSDIR)/$(AROS_DIR_INCLUDE)
107 AROS_LIB := $(AROSDIR)/$(AROS_DIR_LIB)
109 AROS_CONTRIB := $(AROSDIR)/$(AROS_DIR_CONTRIB)
111 # The generated files all go under the GENDIR path
112 SCRIPTDIR := $(GENDIR)/scripts
114 MKDEPEND := $(SRCDIR)/scripts/mkdep
115 FETCH := $(SRCDIR)/scripts/fetch.sh
116 CPYDIRREC := @PYTHON@ $(SRCDIR)/scripts/cpy-dir-rec.py
118 # The paths to the generated tools
119 TOOLDIR := $(HOSTDIR)/tools
120 TOOLLIB := $(TOOLDIR)/libtool.a
121 MMAKE := $(TOOLDIR)/mmake$(HOST_EXE_SUFFIX)
122 ARCHTOOL := $(TOOLDIR)/archtool$(HOST_EXE_SUFFIX)
123 ELF2HUNK := $(TOOLDIR)/elf2hunk$(HOST_EXE_SUFFIX)
124 GENMF := $(TOOLDIR)/genmf.py
125 FLEXCAT := $(TOOLDIR)/flexcat$(HOST_EXE_SUFFIX)
126 FD2INLINE := $(TOOLDIR)/fd2inline$(HOST_EXE_SUFFIX)
127 FD2PRAGMA := $(TOOLDIR)/fd2pragma$(HOST_EXE_SUFFIX)
128 SFDC := $(TOOLDIR)/sfdc
129 MODTOOL := $(TOOLDIR)/modtool$(HOST_EXE_SUFFIX)
130 CREATEDTDESC := $(TOOLDIR)/createdtdesc$(HOST_EXE_SUFFIX)
131 AFSLIB := $(TOOLDIR)/libafs.a
132 COPYTOAFS := $(TOOLDIR)/copytoafs$(HOST_EXE_SUFFIX)
133 ILBMTOC := $(TOOLDIR)/ilbmtoc$(HOST_EXE_SUFFIX)
134 ILBMTOICON := $(TOOLDIR)/ilbmtoicon$(HOST_EXE_SUFFIX)
135 INFOINFO := $(TOOLDIR)/infoinfo$(HOST_EXE_SUFFIX)
136 GENSETS := $(TOOLDIR)/gensets$(HOST_EXE_SUFFIX)
137 COLLECT-AROS := $(TOOLDIR)/collect-aros$(HOST_EXE_SUFFIX)
138 GENMODULE := $(TOOLDIR)/genmodule$(HOST_EXE_SUFFIX)
139 SETREV := $(TOOLDIR)/setrev$(HOST_EXE_SUFFIX)
140 MKSUNXIBOOT := $(TOOLDIR)/mksunxiboot$(HOST_EXE_SUFFIX)
142 RESIDENT_BEGIN := compiler/libinit/libentry
143 KICKSTART_BEGIN := compiler/libinit/kickentry
145 AROS_CC := $(TARGET_CC)
146 ifneq ($(TARGET_CXX),)
147 AROS_CXX := $(TARGET_CXX)
149 AROS_CXX := $(CROSSTOOLSDIR)/$(AROS_TARGET_CPU)-aros-g++
151 AROS_CXXEXTS := cpp cxx cc c++
152 AROS_AS := $(TARGET_AS)
153 AROS_LD := $(TARGET_LD)
155 STRIP := $(TARGET_STRIP)
157 CALL := env AROS_HOST_ARCH=$(AROS_HOST_ARCH) AROS_HOST_CPU=$(AROS_HOST_CPU) \
158 AROS_TARGET_ARCH=$(AROS_TARGET_ARCH) AROS_TARGET_CPU=$(AROS_TARGET_CPU) \
159 AROS_TARGET_VARIANT=$(AROS_TARGET_VARIANT) AROS_TARGET_SUFFIX=$(AROS_TARGET_SUFFIX)
161 # At the moment we have two copies of the includes...
162 # This is the AROS includes, minus clib/mlib.
163 GENINCDIR := $(GENDIR)/include
165 # Basic make configuration. No need to edit anything else under here.
168 .SUFFIXES : .c .h .d .s .S
170 .PHONY : all clean setup subdirs
172 # Was debugging enabled? Better set up the options.
174 CONFIG_CFLAGS += $(DEBUG_CFLAGS)
175 CONFIG_AFLAGS += $(DEBUG_AFLAGS)
176 CONFIG_LDFLAGS += $(DEBUG_LDFLAGS)
177 HOST_CFLAGS += $(DEBUG_CFLAGS)
178 HOST_CXXFLAGS += $(DEBUG_CFLAGS) $(DEBUG_CXXFLAGS)
179 HOST_AFLAGS += $(DEBUG_AFLAGS)
180 HOST_LDFLAGS += $(DEBUG_LDFLAGS)
186 # C and assembly flags are set depending upon the directory
187 CFLAGS = $(USER_INCLUDES) $(CONFIG_CFLAGS) $(USER_CFLAGS)
188 AFLAGS = $(USER_AFLAGS) $(CONFIG_AFLAGS)
189 LDFLAGS = $(USER_LDFLAGS) $(CONFIG_LDFLAGS)
191 # Apple iOS stuff for gcc
192 IOS_LDFLAGS := -F$(IOS_SDK_PATH)/System/Library/Frameworks
194 # Compatibility with old variables
195 OBJDIR := $(GENDIR)/$(CURDIR)
196 LIBDIR := $(AROS_LIB)
197 OSGENDIR := $(GENDIR)/rom
198 KOBJSDIR := $(GENDIR)/kobjs
200 # the build system needs to have some tools in the PATH
202 ifeq ($(AROS_PATH_SET),)
203 TMP_TOOLDIR := $(shell echo $(TOOLDIR) | sed 's/^\(.\):\//\/\1\//')
204 TMP_CROSSTOOLSDIR := $(shell echo $(CROSSTOOLSDIR) | sed 's/^\(.\):\//\/\1\//')
205 PATH := $(TMP_CROSSTOOLSDIR):$(TMP_TOOLDIR):$(TMP_TOOLDIR)/$(AROS_TARGET_CPU)-$(AROS_TARGET_ARCH)$(AROS_TARGET_SUFFIX):$(PATH)
207 export PATH AROS_PATH_SET
210 # Here follow some global variables that can get values through the makefile
211 # and will be handled in make.tail
213 # Dirs to create a makedir rule for
216 # Source directory is added to the target search path
217 VPATH := $(shell echo $(SRCDIR)/$(CURDIR) | sed 's/^\(.\):\//\/\1\//')
219 # Macro for expanding wildcards in source directory
220 # We use shell script here in order to avoid Unicode file names that are listed by pattern expansion but can't be accessed
221 # because of failing Unicode->ACP conversion under Windows
222 WILDCARD = $(shell cd $(SRCDIR)/$(CURDIR); for file in $(1); do if [ -f $$file ]; then printf "%s" "$$file "; fi; done)