/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/Makefile

  • Committer: edam
  • Date: 2012-02-08 23:32:34 UTC
  • Revision ID: edam@waxworlds.org-20120208233234-4h5pzeetrz0vp91f
added phantom button press test and temporarily disabled pin 4 (that drives the PNP transistor)

Show diffs side-by-side

added added

removed removed

122
122
#              target, from those that that would be built for the
123
123
#              project.
124
124
#
 
125
# boards       This is not a real goal.  It just displays a list of
 
126
#              available board names, so that you can set the BOARD
 
127
#              environment variable appropriately.
 
128
#
 
129
# monitor      This is not a real goal.  It starts screen on the serial
 
130
#              device.  It is ment to be an equivelant to the arduino
 
131
#              serial monitor.
125
132
#_______________________________________________________________________________
126
133
#
127
134
 
153
160
endif
154
161
 
155
162
# no target? use default
156
 
ifndef TARGET
 
163
ifeq ($(TARGET), )
157
164
TARGET := a.out
158
165
endif
159
166
 
160
167
# no serial device? attempt to detect an arduino
161
 
ifndef SERIALDEV
 
168
ifeq ($(SERIALDEV), )
162
169
SERIALDEV := $(firstword $(wildcard /dev/ttyACM? /dev/ttyUSB?))
163
170
endif
164
171
 
174
181
# files
175
182
OBJECTS := $(addsuffix .o, $(basename $(SOURCES)))
176
183
ARDUINOSRCDIR := $(ARDUINODIR)/hardware/arduino/cores/arduino
 
184
ARDUINOLIBSDIR := $(ARDUINODIR)/libraries
177
185
ARDUINOLIB := _arduino.a
178
186
ARDUINOLIBTMP := _arduino.a.tmp
179
187
ARDUINOLIBOBJS := $(patsubst %, $(ARDUINOLIBTMP)/%.o, $(basename $(notdir \
180
188
        $(wildcard $(addprefix $(ARDUINOSRCDIR)/, *.c *.cpp)))))
181
189
ARDUINOLIBOBJS += $(foreach lib, $(LIBRARIES), \
182
190
        $(patsubst %, $(ARDUINOLIBTMP)/%.o, $(basename $(notdir \
183
 
        $(wildcard $(addprefix $(ARDUINODIR)/libraries/$(lib)/, *.c *.cpp))))))
 
191
        $(wildcard $(addprefix $(ARDUINOLIBSDIR)/$(lib)/, *.c *.cpp)) \
 
192
        $(wildcard $(addprefix $(ARDUINOLIBSDIR)/$(lib)/utility/, *.c *.cpp)) ))))
184
193
 
185
194
# obtain board parameters from the arduino boards.txt file
186
195
BOARDS_FILE := $(ARDUINODIR)/hardware/arduino/boards.txt
208
217
CPPFLAGS += -mmcu=$(BOARD_BUILD_MCU) -DF_CPU=$(BOARD_BUILD_FCPU)
209
218
CPPFLAGS += -I. -Iutil -Iutility -I$(ARDUINOSRCDIR)
210
219
CPPFLAGS += -I$(ARDUINODIR)/hardware/arduino/variants/$(BOARD_BUILD_VARIANT)/
211
 
CPPFLAGS += $(addprefix -I$(ARDUINODIR)/libraries/,$(LIBRARIES))
 
220
CPPFLAGS += $(addprefix -I$(ARDUINODIR)/libraries/, $(LIBRARIES))
 
221
CPPFLAGS += $(patsubst %, -I$(ARDUINODIR)/libraries/%/utility, $(LIBRARIES))
212
222
AVRDUDEFLAGS = -C $(ARDUINODIR)/hardware/tools/avrdude.conf -DV
213
223
AVRDUDEFLAGS += -p $(BOARD_BUILD_MCU) -P $(SERIALDEV)
214
224
AVRDUDEFLAGS += -c $(BOARD_UPLOAD_PROTOCOL) -b $(BOARD_UPLOAD_SPEED)
220
230
#_______________________________________________________________________________
221
231
#                                                                          RULES
222
232
 
223
 
.PHONY: all target upload clean boards
 
233
.PHONY: all target upload clean boards monitor
224
234
 
225
235
all: target upload
226
236
 
227
237
target: $(TARGET).hex
228
238
 
229
239
upload:
 
240
        @test -n "$(SERIALDEV)" || { echo "SERIALDEV is unset." >&2; exit 1; }
230
241
        stty -F $(SERIALDEV) hupcl
231
242
        $(AVRDUDE) $(AVRDUDEFLAGS) -U flash:w:$(TARGET).hex:i
232
243
 
240
251
        @sed -ne '/^#/d;s/^\(.*\).name=\(.*\)/\1            \2/;T' \
241
252
                -e 's/\(.\{12\}\) *\(.*\)/\1 \2/;p' $(BOARDS_FILE)
242
253
 
 
254
monitor:
 
255
        @test -n "$(SERIALDEV)" || { echo "SERIALDEV is unset." >&2; exit 1; }
 
256
        screen $(SERIALDEV)
 
257
 
243
258
# building the target
244
259
 
245
260
$(TARGET).hex: $(TARGET).elf
279
294
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/%.cpp
280
295
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)
281
296
        $(COMPILE.cpp) -o $@ $<
 
297
 
 
298
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/utility/%.c
 
299
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)
 
300
        $(COMPILE.c) -o $@ $<
 
301
 
 
302
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/utility/%.cpp
 
303
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)
 
304
        $(COMPILE.cpp) -o $@ $<