-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
98 lines (73 loc) · 2.75 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
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
VERSION_MAIN = 1
VERSION_SUB = 6
CC = gcc
OBJS = main.o hex.o
EXECPATH = binaries
DISTPATH = dist
ifeq ($(shell uname -s),Darwin)
# Rules for Mac OS X
OBJS += usb-osx.o
CFLAGS = -fast
LDFLAGS = -Wl,-framework,IOKit,-framework,CoreFoundation
SYSTEM = osx
else
# Rules for Linux, etc.
OBJS += usb-libusb.o
CFLAGS = -O3
LDFLAGS = -lusb
SYSTEM = linux
endif
CFLAGS += -DVERSION_MAIN=$(VERSION_MAIN) -DVERSION_SUB=$(VERSION_SUB)
all:
@echo
@echo Please make 'mphidflash32' or 'mphidflash64' for 32 or 64 bit version
@echo
*.o: mphidflash.h
.c.o:
$(CC) $(CFLAGS) -c $*.c
mphidflash64: CFLAGS += -m64
mphidflash64: LDFLAGS += -m64
mphidflash64: EXEC = mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-$(SYSTEM)-64
mphidflash64: mphidflash
mphidflash32: CFLAGS += -m32
mphidflash32: LDFLAGS += -m32
mphidflash32: EXEC = mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-$(SYSTEM)-32
mphidflash32: mphidflash
mphidflasharm:
mphidflasharm:
mphidflasharm: EXEC = mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-$(SYSTEM)-arm
mphidflasharm: mphidflash
mphidflashpi: CFLAGS += -march=armv6 -mfloat-abi=hard -mfpu=vfp
mphidflashpi: LDFAGS +=
mphidflashpi: EXEC = mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-$(SYSTEM)-pi
mphidflashpi: mphidflash
mphidflash: $(OBJS)
$(CC) $(OBJS) $(LDFLAGS) -o $(EXECPATH)/$(EXEC)
strip $(EXECPATH)/$(EXEC)
install:
@echo
@echo Please make 'install32, install64, installpi or installarm' to install various targets
@echo
# Must install as root; e.g. 'sudo make install'
install32: mphidflash32
cp $(EXECPATH)/mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-$(SYSTEM)-32 /usr/local/bin/mphidflash
install64: mphidflash64
cp $(EXECPATH)/mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-$(SYSTEM)-64 /usr/local/bin/mphidflash
installpi: mphidflashpi
cp $(EXECPATH)/mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-$(SYSTEM)-pi /usr/local/bin/mphidflash
installpi: mphidflasharm
cp $(EXECPATH)/mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-$(SYSTEM)-arm /usr/local/bin/mphidflash
clean:
rm -f *.o core
bindist: tarball zipfile
srcdist: src-tarball src-zipfile
tarball:
tar cvzf $(DISTPATH)/mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-bin.tar.gz README.txt CHANGELOG COPYING $(EXECPATH)/*$(VERSION_MAIN).$(VERSION_SUB)*
src-tarball:
tar cvzf $(DISTPATH)/mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-src.tar.gz README.txt CHANGELOG COPYING Makefile* *.c *.h
zipfile:
rm -f $(DISTPATH)/mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-bin.zip
zip $(DISTPATH)/mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-bin.zip README.txt CHANGELOG COPYING $(EXECPATH)/*$(VERSION_MAIN).$(VERSION_SUB)*
src-zipfile:
rm -f $(DISTPATH)/mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-src.zip
zip $(DISTPATH)/mphidflash-$(VERSION_MAIN).$(VERSION_SUB)-src.zip README.txt CHANGELOG COPYING Makefile* *.c *.h