forked from FujiNetWIFI/fujinet-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.pmd85
63 lines (46 loc) · 1.46 KB
/
Makefile.pmd85
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
TARGET_EXEC ?= config.bin
BUILD_DIR ?= ./build
SRC_DIRS ?= ./src
CC=zcc
AS=zcc
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *_pmd85.asm)
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
# C to ASM, for debug
ASMGEN := $(SRCS:%=$(BUILD_DIR)/%.asm)
CFLAGS=+pmd85 -DBUILD_PMD85
LDFLAGS=+pmd85 -create-app -o $(TARGET_EXEC)
ASFLAGS=+pmd85
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
# ROM Module
autorun.rmm: romload.bin $(BUILD_DIR)/$(TARGET_EXEC)
(cat romload.bin; dd if=$(BUILD_DIR)/$(TARGET_EXEC) count=4 bs=1 status=none; \
dd if=$(BUILD_DIR)/$(TARGET_EXEC) skip=13 bs=1 status=none) > autorun.rmm
# cp autorun.rmm ../fujinet-firmware/data/webui/device_specific/BUILD_PMD85/
# $(BUILD_DIR)/$(TARGET_EXEC): $(OBJS) $(ASMGEN)
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
$(CC) $(LDFLAGS) $(OBJS)
mv $(TARGET_EXEC) $(BUILD_DIR)
mv $$(basename $(TARGET_EXEC) .bin).ptp $(BUILD_DIR)
# ROM Module boot code
romload.bin:
printf '\xcd\x00\x8c\x00\x00\xff\x5f\x00\x00' > romload.bin
# c source to asm, for debug
$(BUILD_DIR)/%.c.asm: %.c
$(MKDIR_P) $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -a $< -o $@
# c source
$(BUILD_DIR)/%.c.o: %.c
$(MKDIR_P) $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
# asm source
$(BUILD_DIR)/%.asm.o: %.asm
$(MKDIR_P) $(dir $@)
$(AS) $(ASFLAGS) -c $< -o $@
.PHONY: clean all
clean:
$(RM) -r autorun* romload.bin $(BUILD_DIR)
all: autorun.rmm
-include $(DEPS)
MKDIR_P ?= mkdir -p