forked from PaintYourDragon/p9813
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (61 loc) · 1.7 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
EXECS = rgb gamma random demo
LIB_LED = libp9813.a
CC = gcc
LDFLAGS = -lftd2xx
# Platform-specific rules
ifeq ($(shell uname -s),Darwin)
# Mac OS X
CFLAGS = -fast -fomit-frame-pointer -m32
SUDO = sudo
endif
ifeq ($(shell uname -s),Linux)
CFLAGS = -O3 -fomit-frame-pointer
LDFLAGS += -lpthread -lrt -lm
SUDO = sudo
endif
ifeq ($(findstring CYGWIN,$(shell uname -s)),CYGWIN)
CFLAGS = -O3 -fomit-frame-pointer -DCYGWIN
LDFLAGS = /usr/local/lib/ftd2xx.lib
SUDO =
endif
all: $(EXECS)
rgb: rgb.c $(LIB_LED)
$(CC) $(CFLAGS) rgb.c $(LIB_LED) $(LDFLAGS) -o rgb
gamma: gamma.c $(LIB_LED)
$(CC) $(CFLAGS) gamma.c $(LIB_LED) $(LDFLAGS) -o gamma
random: random.c $(LIB_LED)
$(CC) $(CFLAGS) random.c $(LIB_LED) $(LDFLAGS) -o random
demo: demo.c $(LIB_LED)
$(CC) $(CFLAGS) demo.c $(LIB_LED) $(LDFLAGS) -o demo
$(LIB_LED): p9813.o
ar -r $(LIB_LED) p9813.o
p9813.o: p9813.c p9813.h calibration.h
$(CC) $(CFLAGS) p9813.c -c
install:
$(SUDO) cp p9813.h /usr/local/include/
$(SUDO) cp $(LIB_LED) /usr/local/lib/
clean:
rm -f $(EXECS) *.o *.a core
# On Mac and Linux, the Virtual COM Port driver must be unloaded in
# order to use bitbang mode. Use "make unload" to do this, but ALWAYS
# remember to "make load" when done, in order to restore normal serial
# port functionality!
ifeq ($(shell uname -s),Darwin)
# Mac driver stuff
DRIVER = com.FTDI.driver.FTDIUSBSerialDriver
KEXTFLAGS = -b
unload:
sudo kextunload $(KEXTFLAGS) $(DRIVER)
load:
sudo kextload $(KEXTFLAGS) $(DRIVER)
else
ifeq ($(shell uname -s),Linux)
# Linux driver stuff
unload:
sudo modprobe -r ftdi_sio
sudo modprobe -r usbserial
load:
sudo modprobe ftdi_sio
sudo modprobe usbserial
endif
endif