-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile.withoutide
70 lines (63 loc) · 1.55 KB
/
Makefile.withoutide
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
CHIP := 16F1827
CC_BIN := xc8-cc
TARGET := mcu
BUILD_DIR := build
CFLAGS := -mcpu=${CHIP} \
-c -fno-short-double -fno-short-float \
-O2 -fasmfile -maddrqual=ignore \
-xassembler-with-cpp \
-mwarn=-3 -Wa,-a \
-DXPRJ_default=default \
-msummary=-psect,-class,+mem,-hex,-file \
-ginhx032 -Wl,--data-init \
-mno-keep-startup \
-mno-osccal \
-mno-resetbits \
-mno-save-resetbits \
-mno-download \
-mno-stackcall \
-std=c99 -gdwarf-3 \
-mstack=compiled:auto:auto
LDFLAGS := -mcpu=${CHIP} \
-Wl,-Map=${BUILD_DIR}/${TARGET}.map \
-DXPRJ_default=default \
-fno-short-double \
-fno-short-float \
-O2 -fasmfile -maddrqual=ignore \
-xassembler-with-cpp \
-mwarn=-3 -Wa,-a \
-msummary=-psect,-class,+mem,-hex,-file \
-ginhx032 -Wl,--data-init \
-mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits \
-mno-download -mno-stackcall -std=c99 -gdwarf-3 \
-mstack=compiled:auto:auto \
-Wl,--memorysummary,${BUILD_DIR}/memoryfile.xml
SOURCES := \
16F1827.c \
fpga.c \
i2c.c \
main.c \
ssd1306.c
OBJS := $(SOURCES:%.c=${BUILD_DIR}/%.p1)
# we need the realpath of the compiler otherwise
# it doesn't work
ifneq (,$(findstring WINDOWS,$(PATH)))
CC := $(where ${CC_BIN})
else
CC := $(realpath $(shell which ${CC_BIN}))
endif
all: ${BUILD_DIR}/${TARGET}.elf
.PHONY: build/%.p1
${BUILD_DIR}/%.p1: %.c ${INC_DIR}
@mkdir -p ${@D}
${CC} ${CFLAGS} -o $@ $<
.PHONY: ${TARGET}.elf
${BUILD_DIR}/${TARGET}.elf: ${OBJS}
${CC} ${LDFLAGS} -o $@ $^
.PHONY: clean
clean:
ifneq (,$(findstring WINDOWS,$(PATH)))
@rd /s /q ${BUILD_DIR}
else
@rm -rf ${BUILD_DIR}
endif