forked from tenbaht/sduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (73 loc) · 3 KB
/
Makefile
File metadata and controls
99 lines (73 loc) · 3 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# build all tool binaries on a Linux 64 system
#
# Used system: Linux Mint 19
#
# This assumes that all required cross-compilation environments are properly
# installed.
OSXCC=/opt/osxcross/bin/o64-clang
OSXC++=/opt/osxcross/bin/o64-clang++
OSXPKGCONFIG=/opt/osxcross/bin/x86_64-apple-darwin15-pkg-config
OSXSTRIP=/opt/osxcross/bin/x86_64-apple-darwin15-strip
BINDIR=bin
#BINDIR=../sduino/hardware/sduino/tools
.PHONY: all linux32 linux64 osx windows \
stm8gal stm8gal-windows stm8gal-linux32 stm8gal-linux64 stm8gal-osx \
stm8flash stm8flash-windows stm8flash-linux32 stm8flash-linux64 \
stm8flash-osx
# all tools for all platforms
all: stm8gal stm8flash
# all tools for one platform: Linux 32 bit
linux32: stm8gal-linux32 stm8flash-linux32
# all tools for one platform: Linux 64 bit
linux64: stm8gal-linux64 stm8flash-linux64
# all tools for one platform: OSX 10.11 64 bit
osx: stm8gal-osx stm8flash-osx
# all tools for one platform: Windows 64 bit
windows: stm8gal-windows stm8flash-windows
# stm8gal for all platforms
stm8gal: stm8gal-linux32 stm8gal-linux64 stm8gal-osx stm8gal-windows
# stm8flash for all platforms
stm8flash: stm8flash-windows stm8flash-linux32 stm8flash-linux64 stm8flash-osx
# copy the already compiled binaries into sduino/.../tools
install:
echo "This rule intentionally does not trigger a re-compile."
echo "Run 'make all', 'make stm8gal' or 'make stm8flash' if you really"
echo "want fresh binaries."
cp -av bin/linux* bin/macosx ../sduino/hardware/sduino/tools/
cp -av bin/win/* ../sduino/hardware/sduino/tools/win
# rules for compiling stm8gal
# To pass the extra CFLAGS and LDFLAGS we need a temporary (modified) Makefile
stm8gal-linux32:
TMPMF=$$(mktemp); \
sed '/FLAGS/ s/ = / += /' stm8gal/Makefile > $$TMPMF; \
CFLAGS=-m32 LDFLAGS=-m32 make -C stm8gal -f $$TMPMF clean all; \
rm -f $$TMPMF
install -s -D stm8gal/stm8gal $(BINDIR)/linux32/stm8gal
stm8gal-linux64:
make -C stm8gal clean all
install -s -D stm8gal/stm8gal $(BINDIR)/linux64/stm8gal
stm8gal-osx:
make -C stm8gal CC=$(OSXCC) clean all
install -s --strip-program=$(OSXSTRIP) -D stm8gal/stm8gal $(BINDIR)/macosx/stm8gal
stm8gal-windows:
make -C stm8gal CC=i686-w64-mingw32-gcc OS=Win clean all
install -s -D stm8gal/stm8gal $(BINDIR)/win/stm8gal.exe
# rules for compiling stm8flash
stm8flash-linux32:
make -C stm8flash RELEASE=yes CFLAGS=-m32 clean all
install -s -D stm8flash/stm8flash $(BINDIR)/linux32/stm8flash
stm8flash-linux64:
make -C stm8flash RELEASE=yes clean all
install -s -D stm8flash/stm8flash $(BINDIR)/linux64/stm8flash
stm8flash-osx:
# install dependencies: osxcross-macports install libusb-devel
make -C stm8flash CC=$(OSXCC) CXX=$(OSXC++) \
PKGCONFIG=$(OSXPKGCONFIG) \
RELEASE=yes clean all
install -s --strip-program=$(OSXSTRIP) -D stm8flash/stm8flash $(BINDIR)/macosx/stm8flash
stm8flash-windows:
make -C stm8flash CC=i686-w64-mingw32-gcc \
CFLAGS="-I../lib/windows -L../lib/windows" \
PLATFORM=w7 \
RELEASE=yes clean all
install -s -D stm8flash/stm8flash.exe $(BINDIR)/win/stm8flash.exe