remove the syscalls.h #include from these files that aren't making direct syscalls...
[newos.git] / make.syscfg
blobf593b736dd34d24fc1ed8f611a45d2adf4b9f09c
2 ifeq ($(HOSTTYPE),)
3         HOSTTYPE := $(shell uname -m)
4 endif
5 ifeq ($(OSTYPE),)
6         OSTYPE := $(shell uname -s | awk -F_ '{print $$1}' | tr A-Z a-z)
7 endif
8 ifeq ($(HOSTTYPE),i586)
9         HOSTTYPE = i386
10 endif
11 ifeq ($(HOSTTYPE),i686)
12         HOSTTYPE = i386
13 endif
14 ifeq ($(HOSTTYPE), )
15         HOSTTYPE = i386
16 endif
17 ifeq ($(findstring Macintosh,$(HOSTTYPE)),Macintosh)
18         HOSTTYPE := ppc
19 endif
20 ifeq ($(HOSTTYPE),macintosh)
21         ifeq ($(MACHTYPE),powerpc)
22                 HOSTTYPE := ppc
23         endif
24 endif
25 ifeq ($(ARCH), )
26 #ARCH = $(HOSTTYPE)
27 ARCH = i386
28 #ARCH = sparc
29 #ARCH = sh4
30 #ARCH = alpha
31 #ARCH = sparc64
32 endif
34 HOST_CC := gcc
35 HOST_LD := $(LD)
36 HOST_AS := $(AS)
37 HOST_AR := $(AR)
38 HOST_OBJCOPY := objcopy
39 HOST_OBJDUMP := objdump
40 HOST_STRIP := strip
41 HOST_SIZE := size
43 # setup some local commands
44 ECHO := echo
45 AWK := awk
46 ifeq ($(OSTYPE),SunOS)
47         ECHO := /usr/ucb/echo
48         AWK := gawk
49 endif
50 ifeq ($(findstring solaris,$(OSTYPE)),solaris)
51         ECHO := /usr/ucb/echo
52         AWK := gawk
53 endif
55 CC = $(HOST_CC)
56 LD = $(HOST_LD)
57 AS = $(HOST_AS)
58 AR = $(HOST_AR)
59 OBJCOPY = $(HOST_OBJCOPY)
60 OBJDUMP = $(HOST_OBJDUMP)
61 STRIP = $(HOST_STRIP)
62 SIZE = $(HOST_SIZE)
64 ifeq ($(ARCH),i386)
65         ifneq ($(HOSTTYPE),i386)
66                 CC = i386-elf-gcc
67                 LD = i386-elf-ld
68                 AS = i386-elf-as
69                 AR = i386-elf-ar
70                 OBJCOPY = i386-elf-objcopy
71                 STRIP = i386-elf-strip
72         endif
73         ifeq ($(OSTYPE),cygwin)
74                 CC = i386-elf-gcc
75                 LD = i386-elf-ld
76                 AS = i386-elf-as
77                 AR = i386-elf-ar
78                 OBJCOPY = i386-elf-objcopy
79                 STRIP = i386-elf-strip
80         endif
81         GLOBAL_CFLAGS = -O2
82         KERNEL_CFLAGS = -fno-pic
83         USER_CFLAGS = -fpic
84         GLOBAL_LDFLAGS =
85         TOOLCHAIN_ARCH = i386
86 endif
88 ifeq ($(ARCH),sh4)
89         CC = sh-elf-gcc
90         LD = sh-elf-ld
91         AS = sh-elf-as
92         AR = sh-elf-ar
93         OBJCOPY = sh-elf-objcopy
94         STRIP = sh-elf-strip
95         GLOBAL_CFLAGS = -ml -m4-single-only -mhitachi -O1
96         KERNEL_CFLAGS = -fno-pic
97         USER_CFLAGS = -fpic
98         GLOBAL_LDFLAGS = -EL
99         TOOLCHAIN_ARCH = sh
100 endif
102 ifeq ($(ARCH),sparc64)
103         CC = sparc64-elf-gcc
104         LD = sparc64-elf-ld
105         AS = sparc64-elf-as
106         AR = sparc64-elf-ar
107         OBJCOPY = sparc64-elf-objcopy
108         STRIP = sparc64-elf-strip
109         GLOBAL_CFLAGS =
110         GLOBAL_LDFLAGS =
111         TOOLCHAIN_ARCH = sparc64
112 endif
114 ifeq ($(ARCH),sparc)
115         ifneq ($(HOSTTYPE),sparc)
116                 CC = sparc-elf-gcc
117                 LD = sparc-elf-ld
118                 AS = sparc-elf-as
119                 AR = sparc-elf-ar
120                 OBJCOPY = sparc-elf-objcopy
121                 STRIP = sparc-elf-strip
122         endif
123         GLOBAL_CFLAGS =
124         GLOBAL_LDFLAGS =
125         TOOLCHAIN_ARCH = sparc
126 endif
128 ifeq ($(ARCH),m68k)
129         ifneq ($(HOSTTYPE),m68k)
130                 CC = m68k-elf-gcc
131                 LD = m68k-elf-ld
132                 AS = m68k-elf-as
133                 AR = m68k-elf-ar
134                 OBJCOPY = m68k-elf-objcopy
135                 STRIP = m68k-elf-strip
136                 SIZE = m68k-elf-size
137         endif
138         GLOBAL_CFLAGS = -O0 -g -m68040
139         KERNEL_CFLAGS = -fno-pic
140         USER_CFLAGS = -fpic
141         GLOBAL_LDFLAGS = -g
142         TOOLCHAIN_ARCH = m68k
143 endif
145 ifeq ($(ARCH),alpha)
146         ifneq ($(HOSTTYPE),alpha)
147                 CC = alpha-elf-gcc
148                 LD = alpha-elf-ld
149                 AS = alpha-elf-as
150                 AR = alpha-elf-ar
151                 OBJCOPY = alpha-elf-objcopy
152         endif
153         GLOBAL_CFLAGS =
154         GLOBAL_LDFLAGS =
155         TOOLCHAIN_ARCH = alpha
156 endif
158 ifeq ($(ARCH),mips)
159         ifneq ($(HOSTTYPE),mips)
160                 CC = mips-elf-gcc
161                 LD = mips-elf-ld
162                 AS = mips-elf-as
163                 AR = mips-elf-ar
164                 OBJCOPY = mips-elf-objcopy
165         endif
166         GLOBAL_CFLAGS = -fno-pic -mips4 -meb -G 0
167         GLOBAL_LDFLAGS =
168         TOOLCHAIN_ARCH = mips
169 endif
171 ifeq ($(ARCH),ppc)
172         ifneq ($(HOSTTYPE),ppc)
173                 CC = ppc-elf-gcc
174                 LD = ppc-elf-ld
175                 AS = ppc-elf-as
176                 AR = ppc-elf-ar
177                 OBJCOPY = ppc-elf-objcopy
178                 STRIP = ppc-elf-strip
179         endif
180         GLOBAL_CFLAGS = -fno-pic -O -D__PPC__ -mregnames
181         GLOBAL_LDFLAGS =
182         TOOLCHAIN_ARCH = ppc
183 endif
185 ifeq ($(ARCH),arm)
186         ifneq ($(HOSTTYPE),arm)
187                 CC = arm-elf-gcc
188                 LD = arm-elf-ld
189                 AS = arm-elf-as
190                 AR = arm-elf-ar
191                 OBJCOPY = arm-elf-objcopy
192                 STRIP = arm-elf-strip
193         endif
194         GLOBAL_CFLAGS = -fno-pic -O2
195         GLOBAL_LDFLAGS =
196         TOOLCHAIN_ARCH = arm
197 endif
199 # try to detect if the user has ARCH-newos-gcc installed
201 #  NOTE:
202 #       the "| cat" below looks unnecesary, this is
203 #       to avoid a bug in liberty in certain versions
204 #       of gmake for BeOS
205 FOO := $(shell $(TOOLCHAIN_ARCH)-newos-gcc --version | cat)
206 ifneq ($(FOO),)
207 $(warning found newos toolchain!)
208         CC = $(TOOLCHAIN_ARCH)-newos-gcc
209         LD = $(TOOLCHAIN_ARCH)-newos-ld
210         AS = $(TOOLCHAIN_ARCH)-newos-as
211         AR = $(TOOLCHAIN_ARCH)-newos-ar
212         OBJCOPY = $(TOOLCHAIN_ARCH)-newos-objcopy
213         OBJDUMP = $(TOOLCHAIN_ARCH)-newos-objdump
214         STRIP = $(TOOLCHAIN_ARCH)-newos-strip
215         SIZE = $(TOOLCHAIN_ARCH)-newos-size
216 else
217 $(warning WARNING: custom newos toolchain not found!)
218 $(warning download the appropriate toolchain for your build environment)
219 $(warning at http://newos.sourceforge.net/download.php)
220 endif
222 GLOBAL_CFLAGS += -finline -nostdinc -fno-builtin
223 GLOBAL_CFLAGS += -Wall -W -Wno-multichar -Wno-unused-parameter -Wmissing-prototypes
224 GLOBAL_CFLAGS += -DARCH_$(ARCH) -DNEWOS=1 -D__ARCH__=$(ARCH) -U$(ARCH)
225 GLOBAL_CPPFLAGS = $(GLOBAL_CFLAGS) -fno-rtti
227 # find libgcc
228 LIBGCC := -lgcc
229 LIBGCC_PATH := $(dir $(shell $(CC) $(GLOBAL_CFLAGS) -print-libgcc-file-name))
230 $(warning LIBGCC_PATH = $(LIBGCC_PATH))
231 GLOBAL_CFLAGS += -I$(LIBGCC_PATH)/include
233 # print some info
234 $(warning ARCH = $(ARCH))
236 # figure out where the build dir will be
237 BUILD_DIR = build/$(ARCH)
238 $(warning build dir will be $(BUILD_DIR))
239 $(shell mkdir -p $(BUILD_DIR))