This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Make.config
61 lines (51 loc) · 1.99 KB
/
Make.config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -*- makefile -*-
SHELL = /bin/sh
VPATH = $(SRCDIR)
# Set GCCPREFIX to the customized prefix, if any. Leave empty if the prefix is
# i386-elf-
GCCPREFIX=
# Infer the correct GCCPREFIX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Could not find i386-*-elf compiler toolchain." 1>&2; \
echo "*** Make sure i386-*-elf-gcc is in your PATH" 1>&2; \
echo "*** If your i386-*-elf toolchain has a prefix" 1>&2; \
echo "*** other than 'i386-elf-', set the GCCPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "***" 1>&2; exit 1; fi)
endif
CC = $(GCCPREFIX)gcc
AS = $(GCCPREFIX)as
AR = $(GCCPREFIX)ar
LD = $(GCCPREFIX)ld
NM = $(GCCPREFIX)nm
RANLIB = $(GCCPREFIX)ranlib
OBJCOPY = $(GCCPREFIX)objcopy
OBJDUMP = $(GCCPREFIX)objdump
ifeq ($(strip $(shell command -v $(CC) 2> /dev/null)),)
$(warning *** Compiler ($(CC)) not found. Did you set $$PATH properly? Please refer to the Getting Started section in the documentation for details. ***)
endif
# Compiler and assembler invocation.
DEFINES =
WARNINGS = -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wsystem-headers
CFLAGS = -m32 -g -msoft-float -O0 -fcommon
CPPFLAGS = -nostdinc -I$(SRCDIR) -I$(SRCDIR)/lib
ASFLAGS = -Wa,--gstabs,--32
LDFLAGS =
# LDOPTIONS will be applied directly with 'ld' while LDFLAGS will be applied with 'gcc'.
LDOPTIONS = -melf_i386
DEPS = -MMD -MF $(@:.o=.d)
# Turn off -fstack-protector, which we don't support.
ifeq ($(strip $(shell echo | $(CC) -fno-stack-protector -E - > /dev/null 2>&1; echo $$?)),0)
CFLAGS += -fno-stack-protector
endif
# Turn off --build-id in the linker, which confuses the Pintos loader.
ifeq ($(strip $(shell $(LD) --help | grep -q build-id; echo $$?)),0)
LDFLAGS += -Wl,--build-id=none
endif
PINTOS = $(SRCDIR)/utils/pintos
QEMU = qemu-system-i386