-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathMakefile
90 lines (63 loc) · 2.66 KB
/
Makefile
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
endif
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
endif
include $(DEVKITARM)/gba_rules
BUILD := build
SOURCES := src src/BoyScout src/disc_io
INCLUDES := include build
DATA := data
export LIBGBA_MAJOR := 0
export LIBGBA_MINOR := 5
export LIBGBA_PATCH := 4
VERSION := $(LIBGBA_MAJOR).$(LIBGBA_MINOR).$(LIBGBA_PATCH)
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS := -g -O3 -Wall -Wno-switch -Wno-multichar $(ARCH) $(INCLUDE)
ASFLAGS := -g -Wa,--warn $(ARCH)
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
export TARGET := $(CURDIR)/lib/libgba.a
export VPATH := $(foreach dir,$(DATA),$(CURDIR)/$(dir)) $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/build
.PHONY: $(BUILD) clean docs
$(BUILD):
@[ -d lib ] || mkdir -p lib
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
docs:
doxygen libgba.dox
clean:
@echo clean ...
@rm -fr $(BUILD) *.tar.bz2
install: $(BUILD)
mkdir -p $(DESTDIR)$(DEVKITPRO)/libgba
cp -rv include lib libgba_license.txt $(DESTDIR)$(DEVKITPRO)/libgba
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
$(TARGET): $(OFILES)
$(OFILES_SRC) : $(HFILES)
#---------------------------------------------------------------------------------
%_fnt.h %.fnt.o : %.fnt
$(SILENTMSG) $(notdir $<)
$(SILENTCMD) $(bin2o)
-include $(DEPENDS)
endif
#---------------------------------------------------------------------------------