Check for the compiler's availability early in the `make' run, in
[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 ifeq ($(strip $(shell command -v $(CC) 2> /dev/null)),)
22 $(warning *** Compiler ($(CC)) not found.  Did you set $$PATH properly?  Please refer to the Getting Started section in the documentation for details. ***)
23 endif
24
25 # Compiler and assembler invocation.
26 DEFINES =
27 WARNINGS = -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wsystem-headers
28 CFLAGS = -g -MMD -msoft-float
29 CPPFLAGS = -nostdinc -I$(SRCDIR) -I- -I$(SRCDIR)/lib
30 ASFLAGS = -Wa,--gstabs -MMD
31 LDFLAGS = 
32
33 %.o: %.c
34         $(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS) $(WARNINGS) $(DEFINES)
35
36 %.o: %.S
37         $(CC) -c $< -o $@ $(ASFLAGS) $(CPPFLAGS) $(DEFINES)