-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
58 lines (41 loc) · 1.12 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
.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
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 -fomit-frame-pointer
crt0.o: CFLAGS += -msingle-pic-base -fpic -mpic-register=r10 -msoft-float
LDFLAGS := -L$(LIB) -T MMUld.script \
-lwin -lggl -lhpg -lhplib -lgcc
all: clock_tuner.apt hp39dir.000
believe: clock_tuner.apt
clean:
rm *.o *.elf *.hp
%.apt: %.hp
$(HP2APT) $< $@ "Clock Tuner"
%.hp: %.elf
$(ELF2HP) $< $@
%.elf: $(OBJ)
$(LD) $(OBJ) $(LDFLAGS) -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
hp39dir.000:
echo "HP39AscA B 15 clock_tuner.apt11 Clock Tuner H 10 lib275.sys7 LIB275L " > $@