-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile.linux
52 lines (39 loc) · 1.31 KB
/
Makefile.linux
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
# arm-linux makefile
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source/common source/linux-test source/common/inih
INCLUDES := include source/common/inih
CFLAGS := -Wall -Wno-unused \
-fomit-frame-pointer -ffast-math \
$(ARCH)
OUTPUT := $(CURDIR)/$(TARGET)
TOPDIR := $(CURDIR)
DEPSDIR := $(CURDIR)/$(BUILD)
VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
CFLAGS += $(INCLUDE)
ASFLAGS := -g $(ARCH)
LIBS := -lm -lminizip -lz
all: slowdebug
release: CFLAGS += -O3 -DDEBUGLEVEL=0
testing: CFLAGS += -O3 -DDEBUGLEVEL=1
debug: CFLAGS += -g -O0 -DDEBUGLEVEL=2
slowdebug: CFLAGS += -g -O0 -DDEBUGLEVEL=3
release testing debug slowdebug: $(BUILD) $(OUTPUT).elf
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $(DEPSDIR)/$@
%.o: %.s
$(CC) $(CFLAGS) -c $< -o $(DEPSDIR)/$@
$(BUILD):
@[ -d $@ ] || mkdir -p $@
$(OUTPUT).elf: $(OFILES)
$(CC) $(CFLAGS) $(LIBS) -o $@ $(BUILD)/*.o
clean:
@rm -rf build $(OUTPUT).elf