-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (43 loc) · 1.39 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
.SUFFIXES:
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
include $(DEVKITARM)/ds_rules
TARGET := dsfirmverify
BUILD := obj
CFILES := main.c aes.c sha256.c
BINFILES := blowfish_retail.bin blowfish_dev.bin
ARCH := -mthumb -mthumb-interwork
CFLAGS := -g $(ARCH) -O2 -fdiagnostics-color=always -D_GNU_SOURCE -DARM9 \
-Wall -Wextra -pedantic -std=gnu11 \
-march=armv5te -mtune=arm946e-s \
-fomit-frame-pointer -ffast-math \
-I$(LIBNDS)/include -I$(TOPDIR)/libncgc/include
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lnds9 -lncgc
ifneq ($(BUILD),$(notdir $(CURDIR)))
export TOPDIR := $(CURDIR)
.PHONY: $(BUILD) libncgc clean
$(BUILD): libncgc
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
libncgc:
@$(MAKE) PLATFORM=ntr -C $(CURDIR)/libncgc
clean:
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds
else
export LD := $(CC)
export VPATH := $(TOPDIR)/src $(TOPDIR)/src/aes
export OUTPUT := $(TOPDIR)/$(TARGET)
export DEPSDIR := $(TOPDIR)/$(BUILD)
export OFILES := $(BINFILES:.bin=.o) $(CFILES:.c=.o)
export LIBPATHS := -L$(LIBNDS)/lib -L$(TOPDIR)/libncgc/out/ntr
DEPENDS := $(OFILES:.o=.d)
$(OUTPUT).nds: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)
%.o: %.bin
@echo $(notdir $<)
$(bin2o)
-include $(DEPENDS)
endif