/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-14 16:55:37 UTC
  • Revision ID: edam@waxworlds.org-20120114165537-71ftm2myrqoztubn
added DS1307 real-time clock library and updated 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.
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
 
171
ifeq ($(SERIALDEV), )
 
172
$(error SERIALDEV is unset and could not be automatically determined)
 
173
endif
164
174
 
165
175
# no board? oh dear...
166
176
ifndef BOARD
174
184
# files
175
185
OBJECTS := $(addsuffix .o, $(basename $(SOURCES)))
176
186
ARDUINOSRCDIR := $(ARDUINODIR)/hardware/arduino/cores/arduino
 
187
ARDUINOLIBSDIR := $(ARDUINODIR)/libraries
177
188
ARDUINOLIB := _arduino.a
178
189
ARDUINOLIBTMP := _arduino.a.tmp
179
190
ARDUINOLIBOBJS := $(patsubst %, $(ARDUINOLIBTMP)/%.o, $(basename $(notdir \
180
191
        $(wildcard $(addprefix $(ARDUINOSRCDIR)/, *.c *.cpp)))))
181
192
ARDUINOLIBOBJS += $(foreach lib, $(LIBRARIES), \
182
193
        $(patsubst %, $(ARDUINOLIBTMP)/%.o, $(basename $(notdir \
183
 
        $(wildcard $(addprefix $(ARDUINODIR)/libraries/$(lib)/, *.c *.cpp))))))
 
194
        $(wildcard $(addprefix $(ARDUINOLIBSDIR)/$(lib)/, *.c *.cpp)) \
 
195
        $(wildcard $(addprefix $(ARDUINOLIBSDIR)/$(lib)/utility/, *.c *.cpp)) ))))
184
196
 
185
197
# obtain board parameters from the arduino boards.txt file
186
198
BOARDS_FILE := $(ARDUINODIR)/hardware/arduino/boards.txt
208
220
CPPFLAGS += -mmcu=$(BOARD_BUILD_MCU) -DF_CPU=$(BOARD_BUILD_FCPU)
209
221
CPPFLAGS += -I. -Iutil -Iutility -I$(ARDUINOSRCDIR)
210
222
CPPFLAGS += -I$(ARDUINODIR)/hardware/arduino/variants/$(BOARD_BUILD_VARIANT)/
211
 
CPPFLAGS += $(addprefix -I$(ARDUINODIR)/libraries/,$(LIBRARIES))
 
223
CPPFLAGS += $(addprefix -I$(ARDUINODIR)/libraries/, $(LIBRARIES))
 
224
CPPFLAGS += $(patsubst %, -I$(ARDUINODIR)/libraries/%/utility, $(LIBRARIES))
212
225
AVRDUDEFLAGS = -C $(ARDUINODIR)/hardware/tools/avrdude.conf -DV
213
226
AVRDUDEFLAGS += -p $(BOARD_BUILD_MCU) -P $(SERIALDEV)
214
227
AVRDUDEFLAGS += -c $(BOARD_UPLOAD_PROTOCOL) -b $(BOARD_UPLOAD_SPEED)
220
233
#_______________________________________________________________________________
221
234
#                                                                          RULES
222
235
 
223
 
.PHONY: all target upload clean boards
 
236
.PHONY: all target upload clean boards monitor
224
237
 
225
238
all: target upload
226
239
 
240
253
        @sed -ne '/^#/d;s/^\(.*\).name=\(.*\)/\1            \2/;T' \
241
254
                -e 's/\(.\{12\}\) *\(.*\)/\1 \2/;p' $(BOARDS_FILE)
242
255
 
 
256
monitor:
 
257
        screen $(SERIALDEV)
 
258
 
243
259
# building the target
244
260
 
245
261
$(TARGET).hex: $(TARGET).elf
279
295
$(ARDUINOLIBTMP)/%.o: $(ARDUINODIR)/libraries/*/%.cpp
280
296
        @test -d $(ARDUINOLIBTMP) || mkdir $(ARDUINOLIBTMP)
281
297
        $(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 $@ $<