-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.inc
55 lines (48 loc) · 1.76 KB
/
Makefile.inc
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
.PHONY: all clean
export RELEASE =
export SHELL :=/bin/bash
export ROOT_DIR =$(CURDIR)/$(ROOT_PATH)
export BUILD_DIR =$(ROOT_DIR)/build
export BIN_DIR =$(ROOT_DIR)/bin
export TARGET :=i686-elf
export CC :=$(TARGET)-gcc
export LD :=$(TARGET)-ld
export AR :=$(TARGET)-ar
export ASFLAGS =-I$(ROOT_DIR)/include \
-Wa,-I$(ROOT_DIR)/include,--32
export DEPEND :=makedepend
export DD :=dd
export EN_DEBUG :=$(if $(RELEASE),,-DDEBUG -g)
export OPT_LEVEL :=$(if $(RELEASE),2,0)
export CFLAGS =-m32 -I$(ROOT_DIR)/include -std=gnu11 \
-fno-leading-underscore -ffreestanding \
-fno-stack-protector -fno-stack-check \
-fno-asynchronous-unwind-tables -march=pentium4 \
$(if $(RELEASE),,-DDEBUG -ggdb) \
-O$(OPT_LEVEL) -Wall -Wextra -Wshadow \
-Wpointer-arith -Wsign-compare -Wsystem-headers \
-Wstrict-prototypes -Wunused-function -Wmissing-prototypes \
-Wmissing-declarations -Wnonnull \
-Waddress-of-packed-member -Wno-expansion-to-defined \
-Werror=nonnull -Winit-self -Wnull-dereference \
-Wmisleading-indentation -Wswitch-enum -Wswitch-default \
-Wduplicated-branches -Wduplicated-cond -Wundef \
-Wcast-qual -Wcast-align -Wdangling-else \
-Wlogical-op -Wpacked
export LDFLAGS :=$(if $(RELEASE),,-g) -static -nostdlib -z nodefaultlib
export FLOPPY_IMG=$(ROOT_DIR)/os_floppy.img
TOP =$(shell if [ -f "Makefile.top" ]; then echo 1; else echo ""; fi)
DEPDIR :=.deps
DEPFLAGS =-MT $@ -MMD -MP -MF $(DEPDIR)/$*.d
TESTDIR :=test
%.o: %.c $(DEPDIR)/%.d | $(DEPDIR)
$(CC) -c $(DEPFLAGS) $(CFLAGS) $< -o $@
%.o: %.S $(DEPDIR)/%.d | $(DEPDIR)
$(CC) -c $(DEPFLAGS) $(ASFLAGS) $< -o $@
%.dmp: %
objdump -Dx $< > $@
%.sym: %
readelf --syms $< > $@
%.bsym: %
nm $< | awk -- '{ print $$1, $$3 }' > $@
DEPFILES := $(SRC:%.c=$(DEPDIR)/%.d) $(ASM_SRC:%.S=$(DEPDIR)/%.d)