f9822b66d468f3198b504056f538bbb8b09b08bb
[pintos-anon] / src / Make.config
1 # -*- makefile -*-
2
3 SHELL = /bin/sh
4
5 VPATH = $(SRCDIR)
6
7 # Binary utilities.
8 # If the host appears to be x86, use the normal tools.
9 # Otherwise assume cross-tools are installed as i386-elf-*.
10 X86 = i.86\|pentium.*\|[pk][56]\|nexgen\|viac3\|6x86\|athlon.*
11 ifneq (0, $(shell expr `uname -m` : '$(X86)'))
12 CC = gcc
13 LD = ld
14 OBJCOPY = objcopy
15 else
16 CC = i386-elf-gcc
17 LD = i386-elf-ld
18 OBJCOPY = i386-elf-objcopy
19 endif
20
21 # GCC 3.3 specifies directories for #include <> as "-I- -Idir"
22 # GCC 4.x specifies directories for #include <> as "-isystem dir"
23 # Figure out which format to use.
24 ifeq (0, $(shell $(CC) -v 2>&1 | grep 'gcc version 4' >/dev/null 2>&1; echo $$?))
25 SYSINCFLAGS = $(patsubst %,-isystem %,$(SYSINCDIRS))
26 else
27 SYSINCFLAGS = -I- $(patsubst %,-I%,$(SYSINCDIRS))
28 endif
29
30 # Compiler and assembler invocation.
31 DEFINES =
32 WARNINGS = -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wsystem-headers
33 CFLAGS = -g -MMD -msoft-float -masm=intel
34 SYSINCDIRS = $(SRCDIR)/lib
35 CPPFLAGS = -nostdinc -I$(SRCDIR) $(SYSINCFLAGS)
36 ASFLAGS = -Wa,--gstabs -MMD
37 LDFLAGS = 
38
39 %.o: %.c
40         $(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS) $(WARNINGS) $(DEFINES)
41
42 %.o: %.S
43         $(CC) -c $< -o $@ $(ASFLAGS) $(CPPFLAGS) $(DEFINES)