-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (54 loc) · 1.76 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
60
61
62
63
64
65
66
67
68
69
70
71
72
# Unix makefile for building
chip ?= 16F1705
xtal_freq ?= 8000000
xc8 ?= /opt/microchip/xc8/*/bin/xc8
xc8_opts += \
--chip=$(chip) \
--double=24 \
--float=24 \
--opt=+asm,+asmfile,-speed,+space \
--mode=free \
-D_XTAL_FREQ=$(xtal_freq) \
-DPIC$(chip)
main_target = install/lib/libpic170x_$(chip)_$(xtal_freq).lpp
build_dir = build/$(chip)/$(xtal_freq)/
source_files := \
freq.c timer0.c io_control.c
header_files := \
libpic170x.X/libpic170x/timer0.h \
libpic170x.X/libpic170x/freq.h \
libpic170x.X/libpic170x/io_control.h
install_header_dir := install/include/libpic170x/
install_header_files = \
$(addprefix $(install_header_dir),$(notdir $(header_files)))
library_version := $(shell cat VERSION)
.PHONY: all doc clean release check_version library
all: library $(install_header_files)
library: $(main_target)
clean:
rm -rf build
rm -rf install/doc/
rm -rf install/include/
rm -rf install/lib/
$(main_target): $(addprefix $(build_dir),$(notdir $(addsuffix .p1,$(basename $(source_files)))))
mkdir -p $(dir $@)
$(xc8) $(xc8_opts) --output=lpp -O$@ $^
$(install_header_dir):
mkdir -p $(install_header_dir)
$(install_header_dir)%.h: libpic170x.X/libpic170x/%.h $(install_header_dir)
cp -v $< $@
$(build_dir)%.p1: libpic170x.X/%.c $(header_files)
mkdir -p $(build_dir)
$(xc8) $(xc8_opts) --pass1 -O$@ $<
doc:
VERSION_NUMBER=$(library_version) doxygen
check_version:
bash ./check_version.sh $(library_version)
release: check_version clean
bash build_all.sh
rm -rf install/release/*
mkdir -p install/release/libpic170x
cp -rv install/doc/html install/release/libpic170x/doc
cp -rv install/lib install/release/libpic170x/lib
cp -rv install/include install/release/libpic170x/include
cd install/release && zip -r9T libpic170x_v$(library_version).zip libpic170x