aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/rules.mk
diff options
context:
space:
mode:
authorPerry Hung <iperry@alum.mit.edu>2010-06-24 11:16:26 -0400
committerPerry Hung <iperry@alum.mit.edu>2010-06-25 21:23:04 -0400
commit2c043efb66416f3d5cd85f0939054766082354de (patch)
treed5b79a987b9e6e029a0b3b0355bd925f98960940 /wirish/rules.mk
parent70a18f96b6d55d23ce58ab40ffb61f172c8f6c73 (diff)
downloadlibrambutan-2c043efb66416f3d5cd85f0939054766082354de.tar.gz
librambutan-2c043efb66416f3d5cd85f0939054766082354de.zip
make: Modularize makefiles, add dependency tracking, build-type tracking
Major build system rewrite. New and exciting: 1. Proper dependency tracking. All source files including header files should be properly tracked and recompiled as necessary when they are changed. 2. Build-type tracking. If the target changes from 'ram' to 'flash,' for example, the build system will force a rebuild rather than incorrectly link modules to a different address. 3. New targets: The old 'ram,' 'flash,' and 'jtag' targets have been replaced with the environment variable MAPLE_TARGET, which controls the link address. Users can either export it to their environment, or pass MAPLE_TARGET on the command-line. Once this is set, sketches can be compiled with 'make sketch,' or simply 'make.' Note: the default is MAPLE_TARGET='flash.' The target 'install' now automagically uploads the sketch to the board using the appropriate method. The 'run' target has been renamed to 'debug.' It starts an openocd gdb server. 4. Odds and ends: -Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default is quiet. -Object file sizes and disassembly information is generated and placed in build/$(BOARD).sizes and build/$(BOARD).disas, respectively. -Parallel make with -j should speed things up if you have multiple cores.
Diffstat (limited to 'wirish/rules.mk')
-rw-r--r--wirish/rules.mk43
1 files changed, 43 insertions, 0 deletions
diff --git a/wirish/rules.mk b/wirish/rules.mk
new file mode 100644
index 0000000..e74d15d
--- /dev/null
+++ b/wirish/rules.mk
@@ -0,0 +1,43 @@
+# Standard things
+sp := $(sp).x
+dirstack_$(sp) := $(d)
+d := $(dir)
+BUILDDIRS += $(BUILD_PATH)/$(d)
+BUILDDIRS += $(BUILD_PATH)/$(d)/comm
+
+WIRISH_INCLUDES := -I$(d) -I$(d)/comm
+
+# Local flags
+CFLAGS_$(d) := $(WIRISH_INCLUDES) $(LIBMAPLE_INCLUDES)
+
+# Local rules and targets
+cSRCS_$(d) := wirish.c \
+ wirish_shift.c \
+ wirish_analog.c \
+ time.c \
+ pwm.c \
+ ext_interrupts.c \
+ wirish_digital.c
+
+cppSRCS_$(d) := wirish_math.cpp \
+ Print.cpp \
+ comm/HardwareSerial.cpp \
+ comm/HardwareSPI.cpp \
+ usb_serial.cpp \
+ cxxabi-compat.cpp
+
+cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%)
+cppFILES_$(d) := $(cppSRCS_$(d):%=$(d)/%)
+
+OBJS_$(d) := $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) \
+ $(cppFILES_$(d):%.cpp=$(BUILD_PATH)/%.o)
+DEPS_$(d) := $(OBJS_$(d):%.o=%.d)
+
+$(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d))
+
+TGT_BIN += $(OBJS_$(d))
+
+# Standard things
+-include $(DEPS_$(d))
+d := $(dirstack_$(sp))
+sp := $(basename $(sp))