IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Commit Details
Date: | 2011-02-11 13:42:21 (13 years 1 month ago) |
---|---|
Author: | Werner Almesberger |
Commit: | c1dc00ee44a8e9839f1913029dc21906cd0c0797 |
Message: | fw2/Makefile: dependencies, verbosity control, cleanup - Makefile (SHELL): require bash for PIPESTATUS used for dependencies - Makefile: added copyright header - Makefile: added section titles - Makefile: added verbosity control - Makefile: added automatic dependency generation - Makefile (clean): also remove .d files |
Files: |
atusb/fw2/Makefile (2 diffs) |
Change Details
atusb/fw2/Makefile | ||
---|---|---|
1 | # | |
2 | # Makefile - Makefile of the ATUSB firmware | |
3 | # | |
4 | # Written 2010-2011 by Werner Almesberger | |
5 | # Copyright 2010-2011 by Werner Almesberger | |
6 | # | |
7 | # This program is free software; you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation; either version 2 of the License, or | |
10 | # (at your option) any later version. | |
11 | # | |
12 | ||
13 | SHELL = /bin/bash | |
14 | ||
1 | 15 | NAME = atusb |
2 | 16 | |
3 | 17 | CFLAGS = -g -Wall -Wextra -Wshadow -Werror -Wno-unused \ |
... | ... | |
21 | 35 | -I$(FreakUSB)/usb -I$(FreakUSB)/hw/at90usbxx2 \ |
22 | 36 | -DNUM_EPS=1 |
23 | 37 | |
38 | # ----- Verbosity control ----------------------------------------------------- | |
39 | ||
40 | CC_normal := $(CC) | |
41 | BUILD_normal := | |
42 | DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG | |
43 | ||
44 | CC_quiet = @echo " CC " $@ && $(CC_normal) | |
45 | BUILD_quiet = @echo " BUILD " $@ && $(BUILD_normal) | |
46 | DEPEND_quiet = @$(DEPEND_normal) | |
47 | ||
48 | ifeq ($(V),1) | |
49 | CC = $(CC_normal) | |
50 | BUILD = $(BUILD_normal) | |
51 | DEPEND = $(DEPEND_normal) | |
52 | else | |
53 | CC = $(CC_quiet) | |
54 | BUILD = $(BUILD_quiet) | |
55 | DEPEND = $(DEPEND_quiet) | |
56 | endif | |
57 | ||
58 | # ----- Rules ----------------------------------------------------------------- | |
24 | 59 | |
25 | 60 | .PHONY: all clean upload prog |
26 | 61 | |
27 | 62 | all: $(NAME).bin |
28 | 63 | |
29 | %.o: %.c | |
30 | $(CC) $(CFLAGS) -mmcu=$(CHIP) -Os -c $< | |
31 | ||
32 | 64 | $(NAME).elf: $(OBJS) |
33 | 65 | $(CC) $(CFLAGS) -mmcu=$(CHIP) -o $@ $(OBJS) |
34 | 66 | |
35 | 67 | %.bin: %.elf |
36 | $(OBJCOPY) -j .text -j .data -O binary $< $@ | |
68 | $(BUILD) $(OBJCOPY) -j .text -j .data -O binary $< $@ | |
69 | ||
70 | # ----- Cleanup --------------------------------------------------------------- | |
37 | 71 | |
38 | 72 | clean: |
39 | rm -f $(NAME).bin $(NAME).elf $(OBJS) | |
73 | rm -f $(NAME).bin $(NAME).elf $(OBJS) $(OBJS:.o=.d) | |
74 | ||
75 | # ----- Dependencies ---------------------------------------------------------- | |
76 | ||
77 | %.o: %.c | |
78 | $(CC) $(CFLAGS) -mmcu=$(CHIP) -Os -c $< | |
79 | $(DEPEND) $< | \ | |
80 | sed -e \ | |
81 | '/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \ | |
82 | -e '$${g;p;}' -e d >$*.d; \ | |
83 | [ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; } | |
84 | ||
85 | -include $(OBJS:.o=.d) | |
86 | ||
87 | # ----- Programming and device control ---------------------------------------- | |
40 | 88 | |
41 | 89 | upload: $(NAME).bin |
42 | 90 | scp $(NAME).bin jlime: |