Gordons Projects

--> Projects Top-Level GIT

Build system: Add a formulaic setting of Q from V for debugging
[wiringPi] / examples / Makefile
1 #
2 # Makefile:
3 #       wiringPi - Wiring Compatable library for the Raspberry Pi
4 #       https://projects.drogon.net/wiring-pi
5 #
6 #       Copyright (c) 2012 Gordon Henderson
7 #################################################################################
8 # This file is part of wiringPi:
9 #       Wiring Compatable library for the Raspberry Pi
10 #
11 #    wiringPi is free software: you can redistribute it and/or modify
12 #    it under the terms of the GNU Lesser General Public License as published by
13 #    the Free Software Foundation, either version 3 of the License, or
14 #    (at your option) any later version.
15 #
16 #    wiringPi is distributed in the hope that it will be useful,
17 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
18 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 #    GNU Lesser General Public License for more details.
20 #
21 #    You should have received a copy of the GNU Lesser General Public License
22 #    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
23 #################################################################################
24
25 ifneq ($V,1)
26 Q ?= @
27 endif
28
29 #DEBUG  = -g -O0
30 DEBUG   = -O3
31 CC      = gcc
32 INCLUDE = -I/usr/local/include
33 CFLAGS  = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
34
35 LDFLAGS = -L/usr/local/lib
36 LDLIBS    = -lwiringPi -lwiringPiDev -lpthread -lm
37
38 # Should not alter anything below this line
39 ###############################################################################
40
41 SRC     =       blink.c blink8.c blink12.c                                      \
42                 blink12drcs.c                                                   \
43                 pwm.c                                                           \
44                 speed.c wfi.c isr.c isr-osc.c                                   \
45                 lcd.c lcd-adafruit.c clock.c                                    \
46                 nes.c                                                           \
47                 softPwm.c softTone.c                                            \
48                 delayTest.c serialRead.c serialTest.c okLed.c ds1302.c          \
49                 lowPower.c                                                      \
50                 rht03.c piglow.c
51
52 OBJ     =       $(SRC:.c=.o)
53
54 BINS    =       $(SRC:.c=)
55
56 all:    
57         @cat README.TXT
58         @echo "    $(BINS)" | fmt
59         @echo ""
60
61 really-all:     $(BINS)
62
63 blink:  blink.o
64         @echo [link]
65         @$(CC) -o $@ blink.o $(LDFLAGS) $(LDLIBS)
66
67 blink8: blink8.o
68         @echo [link]
69         @$(CC) -o $@ blink8.o $(LDFLAGS) $(LDLIBS)
70
71 blink12drcs:    blink12drcs.o
72         @echo [link]
73         @$(CC) -o $@ blink12drcs.o $(LDFLAGS) $(LDLIBS)
74
75 blink12:        blink12.o
76         @echo [link]
77         @$(CC) -o $@ blink12.o $(LDFLAGS) $(LDLIBS)
78
79 speed:  speed.o
80         @echo [link]
81         @$(CC) -o $@ speed.o $(LDFLAGS) $(LDLIBS)
82
83 lcd:    lcd.o
84         @echo [link]
85         @$(CC) -o $@ lcd.o $(LDFLAGS) $(LDLIBS)
86
87 lcd-adafruit:   lcd-adafruit.o
88         @echo [link]
89         @$(CC) -o $@ lcd-adafruit.o $(LDFLAGS) $(LDLIBS)
90
91 clock:  clock.o
92         @echo [link]
93         @$(CC) -o $@ clock.o $(LDFLAGS) $(LDLIBS)
94
95 wfi:    wfi.o
96         @echo [link]
97         @$(CC) -o $@ wfi.o $(LDFLAGS) $(LDLIBS)
98
99 isr:    isr.o
100         @echo [link]
101         @$(CC) -o $@ isr.o $(LDFLAGS) $(LDLIBS)
102
103 isr-osc:        isr-osc.o
104         @echo [link]
105         @$(CC) -o $@ isr-osc.o $(LDFLAGS) $(LDLIBS)
106
107 nes:    nes.o
108         @echo [link]
109         @$(CC) -o $@ nes.o $(LDFLAGS) $(LDLIBS) 
110
111 rht03:  rht03.o
112         @echo [link]
113         @$(CC) -o $@ rht03.o $(LDFLAGS) $(LDLIBS) 
114
115 pwm:    pwm.o
116         @echo [link]
117         @$(CC) -o $@ pwm.o $(LDFLAGS) $(LDLIBS)
118
119 softPwm:        softPwm.o
120         @echo [link]
121         @$(CC) -o $@ softPwm.o $(LDFLAGS) $(LDLIBS)
122
123 softTone:       softTone.o
124         @echo [link]
125         @$(CC) -o $@ softTone.o $(LDFLAGS) $(LDLIBS)
126
127 delayTest:      delayTest.o
128         @echo [link]
129         @$(CC) -o $@ delayTest.o $(LDFLAGS) $(LDLIBS)
130
131 serialRead:     serialRead.o
132         @echo [link]
133         @$(CC) -o $@ serialRead.o $(LDFLAGS) $(LDLIBS)
134
135 serialTest:     serialTest.o
136         @echo [link]
137         @$(CC) -o $@ serialTest.o $(LDFLAGS) $(LDLIBS)
138
139 okLed:  okLed.o
140         @echo [link]
141         @$(CC) -o $@ okLed.o $(LDFLAGS) $(LDLIBS)
142
143 tone:   tone.o
144         @echo [link]
145         @$(CC) -o $@ tone.o $(LDFLAGS) $(LDLIBS)
146
147 ds1302: ds1302.o
148         @echo [link]
149         @$(CC) -o $@ ds1302.o $(LDFLAGS) $(LDLIBS)
150
151 piglow: piglow.o
152         @echo [link]
153         @$(CC) -o $@ piglow.o $(LDFLAGS) $(LDLIBS)
154
155
156 .c.o:
157         @echo [CC] $<
158         @$(CC) -c $(CFLAGS) $< -o $@
159
160 clean:
161         @echo "[Clean]"
162         @rm -f $(OBJ) *~ core tags $(BINS)
163
164 tags:   $(SRC)
165         @echo [ctags]
166         @ctags $(SRC)
167
168 depend:
169         makedepend -Y $(SRC)
170
171 # DO NOT DELETE