/
Makefile
69 lines (51 loc) · 1.33 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
VERSION=1.0
REVISION=2
CC?=gcc
CFLAGS=-std=gnu99 -Wall -O2 -DVERSION=$(VERSION)
MINGW=i686-w64-mingw32
KASM?=kasm4
PREFIX?=/usr/local
DESTDIR=
MD5SUM=md5sum
ifeq ($(UNAME), Darwin)
MD5SUM=md5 -r
endif
.PHONY: all clean
all: linux
linux: potmux
win32: potmux.exe
code: potmux.asm
$(KASM) -o code $<
potmux.inc: code
xxd -i code | \
sed 's/unsigned char/uint8_t/g' | \
sed 's/unsigned int/uint16_t/g' | \
sed 's/_len/_size/g' > $@
potmux: potmux.c potmux.h potmux.inc symbols.h
$(CC) $(CFLAGS) -o $@ potmux.c
potmux.exe: potmux.c potmux.h potmux.inc symbols.h
$(MINGW)-gcc $(CFLAGS) -o $@ potmux.c
install: potmux
install -d $(DESTDIR)$(PREFIX)/bin
install -m755 potmux $(DESTDIR)$(PREFIX)/bin
uninstall:
rm -f $(PREFIX)/bin/potmux
gerber:
make -C hardware/gerber/
release: gerber zip
git archive --prefix=potmux-$(VERSION)/ -o ../potmux-$(VERSION).tar.gz HEAD && \
$(MD5SUM) ../potmux-$(VERSION).tar.gz > ../potmux-$(VERSION).tar.gz.md5
mv hardware/gerber/potmux-r$(REVISION)-gerber.zip ..
$(MD5SUM) ../potmux-r$(REVISION)-gerber.zip > ../potmux-r$(REVISION)-gerber.zip.md5
mv potmux-$(VERSION).zip ..
$(MD5SUM) ../potmux-$(VERSION).zip > ../potmux-$(VERSION).zip.md5
zip: win32
zip potmux-$(VERSION).zip potmux.exe
clean:
rm -f potmux
rm -f code
rm -f *.inc
rm -f *.d64
rm -f *.prg
rm -f *.exe
rm -f *.exe.stackdump