1 # Makefile - Build the Pololu IMU software 2 # 3 # Copyright (C) 2013 Paul Boddie 4 # 5 # This program is free software; you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation; either version 2 of the License, or 8 # (at your option) any later version. 9 10 LIBUBB = ../ben-blinkenlights/libubb 11 SYSROOT = ../openwrt-xburst/staging_dir/target-mipsel_eglibc-2.15 12 TOOLBIN = ../openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.6-linaro_eglibc-2.15/bin 13 14 ARCH = mipsel-openwrt-linux 15 CC = $(TOOLBIN)/$(ARCH)-gcc 16 17 CFLAGS = -g -Wall -fPIC -march=mips32 -I$(LIBUBB)/include $(shell $(SYSROOT)/usr/bin/sdl-config --cflags) # -DDEBUG=1 18 LDFLAGS = -lm -lubb -L$(LIBUBB) $(shell $(SYSROOT)/usr/bin/sdl-config --libs) -Wl,-rpath-link,$(SYSROOT)/usr/lib -lSDL_gfx 19 20 IMU = imu 21 TEST = itest 22 CALIBRATE = calibrate 23 TARGETS = $(IMU) $(TEST) $(CALIBRATE) 24 25 BASICSRC = imu.c i2c.c shutdown.c geo.c 26 UISRC = measure.c ui.c gui.c 27 28 IMUSRC = $(BASICSRC) $(UISRC) main.c 29 IMUOBJ = $(IMUSRC:.c=.o) 30 31 TESTSRC = $(BASICSRC) $(UISRC) itest.c 32 TESTOBJ = $(TESTSRC:.c=.o) 33 34 CALIBRATESRC = $(BASICSRC) calibrate.c 35 CALIBRATEOBJ = $(CALIBRATESRC:.c=.o) 36 37 ALLSRC = $(BASICSRC) $(UISRC) main.c itest.c calibrate.c 38 ALLOBJ = $(ALLSRC:.c=.o) 39 40 .PHONY: all clean distclean 41 42 all: $(TARGETS) 43 44 clean: 45 rm -f $(ALLOBJ) $(TARGETS) 46 47 distclean: clean 48 echo "Nothing else to clean." 49 50 $(IMU): $(IMUOBJ) 51 $(CC) $(LDFLAGS) $(IMUOBJ) -o $@ 52 53 $(TEST): $(TESTOBJ) 54 $(CC) $(LDFLAGS) $(TESTOBJ) -o $@ 55 56 $(CALIBRATE): $(CALIBRATEOBJ) 57 $(CC) $(LDFLAGS) $(CALIBRATEOBJ) -o $@ 58 59 .c.o: 60 $(CC) -c $(CFLAGS) $< -o $@