]> Pileus Git - ~andy/csm213a-hw/blobdiff - hw2/makefile
Import testing code and update makefiles
[~andy/csm213a-hw] / hw2 / makefile
index 80fdcb8140ea34552a1dc37a50d92422d7145a20..e7c5b4006ffe77909e783aeed7958813a3f0dbb4 100644 (file)
@@ -1,27 +1,40 @@
-PROG  = mbed
-UART0 = /dev/ttyACM0
-UART1 = /dev/ttyACM1
-OBJS  = main.o serial_irq.o serial_dma.o timer_dma.o
+# Common settings
+UART0    = /dev/ttyACM0
+UART1    = /dev/ttyACM1
+CLEAN    = control tags
 
 CPPFLAGS =
 LDFLAGS  = -lm
 
-default: info run
+# Common rules
+default: all
 
-control: control.c messages.h
-       gcc -Wall -o $@ $<
-
-run: all control install.sh
-       @./install.sh $(PROG).bin
-       @./control $(UART0) 1
-       @./control $(UART1) 2 sync
+all: mbed.elf tester.elf control
 
 terms:
-       term /dev/ttyACM0 &
-       term /dev/ttyACM1 &
+       test -c $(UART0) && term $(UART0) &
+       test -c $(UART1) && term $(UART1) &
 
 dist:
        zip mbed.zip makefile ../common.mk *.{c,cpp,h} */*.{cpp,.h}
 
+# Primary mbed (mbed1/mbed2)
+mbed.elf: main.o serial_irq.o serial_dma.o timer_dma.o
+
+mbed-run: mbed.bin control install.sh
+       @./install.sh $<
+       @./control $(UART0) 1
+       @./control $(UART1) 2 sync
+
+# Testing mbed (mbed3)
+tester.elf: tester.o
+
+tester-run: tester.bin install.sh
+       @./install.sh $< /dev/sdb /mnt/usb
+
+# Controls programs
+control: control.c messages.h
+       gcc -Wall -o $@ $<
+
 -include ../config.mk
 -include ../common.mk