/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-01-04 19:16:50 UTC
  • Revision ID: edam@waxworlds.org-20120104191650-eij5qp0hapachu2g
updated arduino makefile

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.
132
125
#_______________________________________________________________________________
133
126
#
134
127
 
160
153
endif
161
154
 
162
155
# no target? use default
163
 
ifeq ($(TARGET), )
 
156
ifndef TARGET
164
157
TARGET := a.out
165
158
endif
166
159
 
167
160
# no serial device? attempt to detect an arduino
168
 
ifeq ($(SERIALDEV), )
 
161
ifndef SERIALDEV
169
162
SERIALDEV := $(firstword $(wildcard /dev/ttyACM? /dev/ttyUSB?))
170
163
endif
171
 
ifeq ($(SERIALDEV), )
172
 
$(error SERIALDEV is unset and could not be automatically determined)
173
 
endif
174
164
 
175
165
# no board? oh dear...
176
166
ifndef BOARD
184
174
# files
185
175
OBJECTS := $(addsuffix .o, $(basename $(SOURCES)))
186
176
ARDUINOSRCDIR := $(ARDUINODIR)/hardware/arduino/cores/arduino
187
 
ARDUINOLIBSDIR := $(ARDUINODIR)/libraries
188
177
ARDUINOLIB := _arduino.a
189
178
ARDUINOLIBTMP := _arduino.a.tmp
190
179
ARDUINOLIBOBJS := $(patsubst %, $(ARDUINOLIBTMP)/%.o, $(basename $(notdir \
191
180
        $(wildcard $(addprefix $(ARDUINOSRCDIR)/, *.c *.cpp)))))
192
181
ARDUINOLIBOBJS += $(foreach lib, $(LIBRARIES), \
193
182
        $(patsubst %, $(ARDUINOLIBTMP)/%.o, $(basename $(notdir \
194
 
        $(wildcard $(addprefix $(ARDUINOLIBSDIR)/$(lib)/, *.c *.cpp)) \
195
 
        $(wildcard $(addprefix $(ARDUINOLIBSDIR)/$(lib)/utility/, *.c *.cpp)) ))))
 
183
        $(wildcard $(addprefix $(ARDUINODIR)/libraries/$(lib)/, *.c *.cpp))))))
196
184
 
197
185
# obtain board parameters from the arduino boards.txt file
198
186
BOARDS_FILE := $(ARDUINODIR)/hardware/arduino/boards.txt
220
208
CPPFLAGS += -mmcu=$(BOARD_BUILD_MCU) -DF_CPU=$(BOARD_BUILD_FCPU)
221
209
CPPFLAGS += -I. -Iutil -Iutility -I$(ARDUINOSRCDIR)
222
210
CPPFLAGS += -I$(ARDUINODIR)/hardware/arduino/variants/$(BOARD_BUILD_VARIANT)/
223
 
CPPFLAGS += $(addprefix -I$(ARDUINODIR)/libraries/, $(LIBRARIES))
224
 
CPPFLAGS += $(patsubst %, -I$(ARDUINODIR)/libraries/%/utility, $(LIBRARIES))
 
211
CPPFLAGS += $(addprefix -I$(ARDUINODIR)/libraries/,$(LIBRARIES))
225
212
AVRDUDEFLAGS = -C $(ARDUINODIR)/hardware/tools/avrdude.conf -DV
226
213
AVRDUDEFLAGS += -p $(BOARD_BUILD_MCU) -P $(SERIALDEV)
227
214
AVRDUDEFLAGS += -c $(BOARD_UPLOAD_PROTOCOL) -b $(BOARD_UPLOAD_SPEED)
233
220
#_______________________________________________________________________________
234
221
#                                                                          RULES
235
222
 
236
 
.PHONY: all target upload clean boards monitor
 
223
.PHONY: all target upload clean boards
237
224
 
238
225
all: target upload
239
226
 
253
240
        @sed -ne '/^#/d;s/^\(.*\).name=\(.*\)/\1            \2/;T' \
254
241
                -e 's/\(.\{12\}\) *\(.*\)/\1 \2/;p' $(BOARDS_FILE)
255
242
 
256
 
monitor:
257
 
        screen $(SERIALDEV)
258
 
 
259
243
# building the target
260
244
 
261
245
$(TARGET).hex: $(TARGET).elf
295
279
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/%.cpp
296
280
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)
297
281
        $(COMPILE.cpp) -o $@ $<
298
 
 
299
 
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/utility/%.c
300
 
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)
301
 
        $(COMPILE.c) -o $@ $<
302
 
 
303
 
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/utility/%.cpp
304
 
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)
305
 
        $(COMPILE.cpp) -o $@ $<