forked from Arnie97/neko-notepad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (41 loc) · 1.14 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
.PHONY: all believe clean
.SECONDARY: $(OBJ)
ifeq ($(TARGET),)
$(info Inspecting compiler to use...)
ifneq ($(shell which arm-elf-gcc),)
TARGET=arm-elf
else
ifneq ($(shell which arm-linux-gcc),)
TARGET=arm-linux
else
$(error No compiler found. Check $$PATH or provide a $$TARGET)
endif
endif
endif
CC := $(TARGET)-gcc
LD := $(TARGET)-ld
ELF2HP ?= elf2hp
HP2APT ?= ./hp2aplet
# KEYGEN ?= ./keygen
SRC ?= $(wildcard *.c)
OBJ ?= $(SRC:%.c=%.o)
INC ?= "$(HPGCC)\include"
LIB ?= "$(HPGCC)\lib"
CFLAGS ?= -std=c99 -Wall -Os -I$(INC) -L$(LIB) \
-mtune=arm920t -mcpu=arm920t -mlittle-endian -msoft-float \
-fomit-frame-pointer -fdata-sections -ffunction-sections
crt0.o: CFLAGS += -msingle-pic-base -fpic -mpic-register=r10
# main.o: CFLAGS += -DVALID_HASH=$(shell $(KEYGEN) $(SN))
LDFLAGS := -L$(LIB) -T MMUld.script -lhplib -lgcc -static --gc-sections
all: believe hp39dir.000
believe: neko_notepad.apt
clean:
rm *.o *.elf *.hp
%.apt: %.hp
$(HP2APT) $< $@ "Neko Notepad"
%.hp: %.elf
$(ELF2HP) $< $@
%.elf: $(OBJ)
$(LD) $(OBJ) $(LDFLAGS) -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@