|
@@ -170,6 +170,14 @@ ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
|
170
|
170
|
ALL_CXXFLAGS = -mmcu=$(MCU) $(CXXFLAGS)
|
171
|
171
|
ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS)
|
172
|
172
|
|
|
173
|
+# set V=1 (eg, "make V=1") to print the full commands etc.
|
|
174
|
+ifneq ($V,1)
|
|
175
|
+ Pecho=@echo
|
|
176
|
+ P=@
|
|
177
|
+else
|
|
178
|
+ Pecho=@:
|
|
179
|
+ P=
|
|
180
|
+endif
|
173
|
181
|
|
174
|
182
|
# Default target.
|
175
|
183
|
all: sizeafter
|
|
@@ -178,7 +186,7 @@ build: applet elf hex
|
178
|
186
|
|
179
|
187
|
# Creates the object directory
|
180
|
188
|
applet:
|
181
|
|
- @mkdir -p applet
|
|
189
|
+ $P mkdir -p applet
|
182
|
190
|
|
183
|
191
|
# the .cpp for Marlin depends on the .pde
|
184
|
192
|
#applet/$(TARGET).cpp: $(TARGET).pde
|
|
@@ -189,10 +197,10 @@ applet/%.cpp: %.pde $(MAKEFILE)
|
189
|
197
|
# Here is the "preprocessing".
|
190
|
198
|
# It creates a .cpp file based with the same name as the .pde file.
|
191
|
199
|
# On top of the new .cpp file comes the WProgram.h header.
|
192
|
|
- @echo " WR $@"
|
193
|
|
- @echo '#include "WProgram.h"' > $@
|
194
|
|
- @echo '#include "$<"' >>$@
|
195
|
|
- @echo '#include "$(ARDUINO)/main.cpp"' >> $@
|
|
200
|
+ $(Pecho) " WR $@"
|
|
201
|
+ $P echo '#include "WProgram.h"' > $@
|
|
202
|
+ $P echo '#include "$<"' >>$@
|
|
203
|
+ $P echo '#include "$(ARDUINO)/main.cpp"' >> $@
|
196
|
204
|
|
197
|
205
|
elf: applet/$(TARGET).elf
|
198
|
206
|
hex: applet/$(TARGET).hex
|
|
@@ -215,10 +223,10 @@ endif
|
215
|
223
|
HEXSIZE = $(SIZE) --target=$(FORMAT) applet/$(TARGET).hex
|
216
|
224
|
ELFSIZE = $(SIZE) applet/$(TARGET).elf
|
217
|
225
|
sizebefore:
|
218
|
|
- @if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
|
|
226
|
+ $P if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
|
219
|
227
|
|
220
|
228
|
sizeafter: build
|
221
|
|
- @if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
|
|
229
|
+ $P if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
|
222
|
230
|
|
223
|
231
|
|
224
|
232
|
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
|
|
@@ -241,8 +249,8 @@ extcoff: $(TARGET).elf
|
241
|
249
|
.PRECIOUS: .o
|
242
|
250
|
|
243
|
251
|
.elf.hex:
|
244
|
|
- @echo " COPY $@"
|
245
|
|
- @$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
|
252
|
+ $(Pecho) " COPY $@"
|
|
253
|
+ $P $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
246
|
254
|
|
247
|
255
|
.elf.eep:
|
248
|
256
|
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
|
@@ -258,29 +266,29 @@ extcoff: $(TARGET).elf
|
258
|
266
|
|
259
|
267
|
# Link: create ELF output file from library.
|
260
|
268
|
applet/$(TARGET).elf: applet/$(TARGET).cpp applet/core.a Configuration.h
|
261
|
|
- @echo " CXX $@"
|
262
|
|
- @$(CC) $(ALL_CXXFLAGS) -Wl,--gc-sections -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
|
|
269
|
+ $(Pecho) " CXX $@"
|
|
270
|
+ $P $(CC) $(ALL_CXXFLAGS) -Wl,--gc-sections -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
|
263
|
271
|
|
264
|
272
|
applet/core.a: $(OBJ)
|
265
|
|
- @for i in $(OBJ); do echo " AR $$i"; $(AR) rcs applet/core.a $$i; done
|
|
273
|
+ $P for i in $(OBJ); do echo " AR $$i"; $(AR) rcs applet/core.a $$i; done
|
266
|
274
|
|
267
|
275
|
applet/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
|
268
|
|
- @echo " CC $@"
|
269
|
|
- @$(CC) -MMD -c $(ALL_CFLAGS) $< -o $@
|
|
276
|
+ $(Pecho) " CC $@"
|
|
277
|
+ $P $(CC) -MMD -c $(ALL_CFLAGS) $< -o $@
|
270
|
278
|
|
271
|
279
|
applet/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
|
272
|
|
- @echo " CXX $@"
|
273
|
|
- @$(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
|
|
280
|
+ $(Pecho) " CXX $@"
|
|
281
|
+ $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
|
274
|
282
|
|
275
|
283
|
|
276
|
284
|
# Target: clean project.
|
277
|
285
|
clean:
|
278
|
|
- @echo " RM applet/*"
|
279
|
|
- @$(REMOVE) applet/$(TARGET).hex applet/$(TARGET).eep applet/$(TARGET).cof applet/$(TARGET).elf \
|
|
286
|
+ $(Pecho) " RM applet/*"
|
|
287
|
+ $P $(REMOVE) applet/$(TARGET).hex applet/$(TARGET).eep applet/$(TARGET).cof applet/$(TARGET).elf \
|
280
|
288
|
applet/$(TARGET).map applet/$(TARGET).sym applet/$(TARGET).lss applet/$(TARGET).cpp applet/core.a \
|
281
|
289
|
$(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d)
|
282
|
|
- @echo " RMDIR applet/"
|
283
|
|
- @rm -rf applet
|
|
290
|
+ $(Pecho) " RMDIR applet/"
|
|
291
|
+ $P rm -rf applet
|
284
|
292
|
|
285
|
293
|
|
286
|
294
|
.PHONY: all build elf hex eep lss sym program coff extcoff clean depend applet_files sizebefore sizeafter
|