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)
12 # All files corresponding to a specific host go here.
13 HOSTDIR := $(TOP)/bin/$(AROS_HOST_ARCH)-$(AROS_HOST_CPU)
14 TOOLDIR := $(HOSTDIR)/tools
16 HOSTGENDIR := $(HOSTDIR)/gen
18 # All files corresponding to a specific target go here.
19 TARGETDIR := $(TOP)/bin/$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)$(AROS_TARGET_SUFFIX)
21 GENDIR := $(TARGETDIR)/gen
23 -include $(GENDIR)/config/make.defaults
24 -include $(GENDIR)/config/make.opts
26 # target.cfg *must* come before host.cfg
27 include $(GENDIR)/config/target.cfg
28 include $(HOSTGENDIR)/config/host.cfg
30 # Cross tools installation directory.
31 CROSSTOOLSDIR := @AROS_CROSSTOOLSDIR@
33 # Files downloaded from the net are put here
34 PORTSSOURCEDIR := @AROS_PORTSSRCDIR@
35 PORTSDIR := $(TARGETDIR)/Ports
37 # Distributable Files we generate are put here
38 DISTDIR := @AROS_BUILDDIR_UNIX@/distfiles
40 # File for AROS gcc cross compiler spec file
41 SPECS := $(GENDIR)/config/specs
43 # This is the directory structure for an AROS system.
44 AROSDIR := $(TARGETDIR)/AROS
46 # Relative paths for standard directories
48 AROS_DIR_CLASSES := Classes
49 AROS_DIR_DATATYPES := $(AROS_DIR_CLASSES)/Datatypes
50 AROS_DIR_GADGETS := $(AROS_DIR_CLASSES)/Gadgets
53 AROS_DIR_LOCALE := Locale
55 AROS_DIR_DEVELOPMENT := Development
56 AROS_DIR_INCLUDE := $(AROS_DIR_DEVELOPMENT)/include
57 AROS_DIR_LIB := $(AROS_DIR_DEVELOPMENT)/lib
58 AROS_DIR_CONTRIB := Extras
60 # Absolute paths for standard directories
61 AROS_C := $(AROSDIR)/$(AROS_DIR_C)
62 AROS_CLASSES := $(AROSDIR)/$(AROS_DIR_CLASSES)
63 AROS_DATATYPES := $(AROSDIR)/$(AROS_DIR_DATATYPES)
64 AROS_GADGETS := $(AROSDIR)/$(AROS_DIR_GADGETS)
65 AROS_DEVS := $(AROSDIR)/$(AROS_DIR_DEVS)
66 AROS_FS := $(AROS_DEVS)
67 AROS_RESOURCES := $(AROS_DEVS)
68 AROS_DRIVERS := $(AROS_DEVS)/Drivers
69 AROS_LIBS := $(AROSDIR)/$(AROS_DIR_LIBS)
70 AROS_LOCALE := $(AROSDIR)/$(AROS_DIR_LOCALE)
71 AROS_CATALOGS := $(AROS_LOCALE)/Catalogs
72 AROS_HELP := $(AROS_LOCALE)/Help
73 AROS_PREFS := $(AROSDIR)/Prefs
74 AROS_ENVARC := $(AROS_PREFS)/Env-Archive
75 AROS_PACKAGES := $(AROS_ENVARC)/SYS/Packages
76 AROS_S := $(AROSDIR)/$(AROS_DIR_S)
77 AROS_SYSTEM := $(AROSDIR)/System
78 AROS_WANDERER := $(AROS_SYSTEM)/Wanderer
79 AROS_THEMES := $(AROS_SYSTEM)/Themes
80 AROS_IMAGES := $(AROS_SYSTEM)/Images
81 AROS_TOOLS := $(AROSDIR)/Tools
82 AROS_UTILITIES := $(AROSDIR)/Utilities
83 AROS_TESTS := $(AROSDIR)/Tests
85 AROS_DEVELOPMENT := $(AROSDIR)/$(AROS_DIR_DEVELOPMENT)
86 AROS_INCLUDES := $(AROSDIR)/$(AROS_DIR_INCLUDE)
87 AROS_LIB := $(AROSDIR)/$(AROS_DIR_LIB)
89 AROS_CONTRIB := $(AROSDIR)/$(AROS_DIR_CONTRIB)
91 # The generated files all go under the GENDIR path
92 SCRIPTDIR := $(GENDIR)/scripts
94 MKDEPEND := $(SRCDIR)/scripts/mkdep
95 FETCH := $(SRCDIR)/scripts/fetch.sh
97 # The paths to the generated tools
98 TOOLDIR := $(HOSTDIR)/tools
99 TOOLLIB := $(TOOLDIR)/libtool.a
100 MMAKE := $(TOOLDIR)/mmake$(HOST_EXE_SUFFIX)
101 ARCHTOOL := $(TOOLDIR)/archtool$(HOST_EXE_SUFFIX)
102 ELF2HUNK := $(TOOLDIR)/elf2hunk$(HOST_EXE_SUFFIX)
103 GENMF := $(TOOLDIR)/genmf.py
104 FLEXCAT := $(TOOLDIR)/FlexCat$(HOST_EXE_SUFFIX)
105 FD2INLINE := $(TOOLDIR)/fd2inline$(HOST_EXE_SUFFIX)
106 FD2PRAGMA := $(TOOLDIR)/fd2pragma$(HOST_EXE_SUFFIX)
107 SFDC := $(TOOLDIR)/sfdc
108 MODTOOL := $(TOOLDIR)/modtool$(HOST_EXE_SUFFIX)
109 CREATEDTDESC := $(TOOLDIR)/createdtdesc$(HOST_EXE_SUFFIX)
110 AFSLIB := $(TOOLDIR)/libafs.a
111 COPYTOAFS := $(TOOLDIR)/copytoafs$(HOST_EXE_SUFFIX)
112 ILBMTOC := $(TOOLDIR)/ilbmtoc$(HOST_EXE_SUFFIX)
113 ILBMTOICON := $(TOOLDIR)/ilbmtoicon$(HOST_EXE_SUFFIX)
114 GENSETS := $(TOOLDIR)/gensets$(HOST_EXE_SUFFIX)
115 COLLECT-AROS := $(TOOLDIR)/collect-aros$(HOST_EXE_SUFFIX)
116 GENMODULE := $(TOOLDIR)/genmodule$(HOST_EXE_SUFFIX)
117 CXREF := $(TOOLDIR)/cxref$(HOST_EXE_SUFFIX)
118 SETREV := $(TOOLDIR)/setrev$(HOST_EXE_SUFFIX)
120 RESIDENT_BEGIN := compiler/libinit/libentry
122 AROS_CC := $(TARGET_CC)
123 AROS_AS := $(TARGET_AS)
124 AROS_LD := $(TARGET_LD)
126 STRIP := $(TARGET_STRIP)
128 CALL := env AROS_HOST_ARCH=$(AROS_HOST_ARCH) AROS_HOST_CPU=$(AROS_HOST_CPU) \
129 AROS_TARGET_ARCH=$(AROS_TARGET_ARCH) AROS_TARGET_CPU=$(AROS_TARGET_CPU) \
130 AROS_TARGET_VARIANT=$(AROS_TARGET_VARIANT) AROS_TARGET_SUFFIX=$(AROS_TARGET_SUFFIX)
132 # At the moment we have two copies of the includes...
133 # This is the AROS includes, minus clib/mlib.
134 GENINCDIR := $(GENDIR)/include
136 # Basic make configuration. No need to edit anything else under here.
139 .SUFFIXES : .c .h .d .s .S
141 .PHONY : all clean setup subdirs
143 # Was debugging enabled? Better set up the options.
145 CONFIG_CFLAGS += $(DEBUG_CFLAGS)
146 CONFIG_AFLAGS += $(DEBUG_AFLAGS)
147 CONFIG_LDFLAGS += $(DEBUG_LDFLAGS)
148 HOST_CFLAGS += $(DEBUG_CFLAGS)
149 HOST_AFLAGS += $(DEBUG_AFLAGS)
150 HOST_LDFLAGS += $(DEBUG_LDFLAGS)
156 # C and assembly flags are set depending upon the directory
157 CFLAGS = $(USER_INCLUDES) $(CONFIG_CFLAGS) $(USER_CFLAGS)
158 AFLAGS = $(USER_AFLAGS) $(CONFIG_AFLAGS)
159 LDFLAGS = $(USER_LDFLAGS) $(CONFIG_LDFLAGS)
161 # Apple iOS stuff for gcc
162 IOS_LDFLAGS := -F$(IOS_SDK_PATH)/System/Library/Frameworks
164 # Compatibility with old variables
167 OBJDIR := $(GENDIR)/$(CURDIR)
169 EXEDIR := $(AROSDIR)/C
170 LIBDIR := $(AROS_LIB)
171 CONTRIBDIR := $(AROS_CONTRIB)
172 OSGENDIR := $(GENDIR)/rom
173 KOBJSDIR := $(GENDIR)/kobjs
174 PKGDIR := $(GENDIR)/pkg
176 # the build system needs to have some tools in the PATH
178 ifeq ($(AROS_PATH_SET),)
179 TMP_TOOLDIR := $(shell echo $(TOOLDIR) | sed 's/^\(.\):\//\/\1\//')
180 TMP_CROSSTOOLSDIR := $(shell echo $(CROSSTOOLSDIR) | sed 's/^\(.\):\//\/\1\//')
181 PATH := $(TMP_CROSSTOOLSDIR):$(TMP_TOOLDIR):$(TMP_TOOLDIR)/$(AROS_TARGET_CPU)-$(AROS_TARGET_ARCH)$(AROS_TARGET_SUFFIX):$(PATH)
183 export PATH AROS_PATH_SET
186 # Here follow some global variables that can get values through the makefile
187 # and will be handled in make.tail
189 # Dirs to create a makedir rule for
192 # Source directory is added to the target search path
193 VPATH := $(shell echo $(SRCDIR)/$(CURDIR) | sed 's/^\(.\):\//\/\1\//')
195 # Macro for expanding wildcards in source directory
196 # We use shell script here in order to avoid Unicode file names that are listed by pattern expansion but can't be accessed
197 # because of failing Unicode->ACP conversion under Windows
198 WILDCARD = $(shell cd $(SRCDIR)/$(CURDIR); for file in $(1); do if [ -f $$file ]; then printf "%s" "$$file "; fi; done)