1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/Makefile Mon Oct 14 13:02:19 2013 +0000
1.3 @@ -0,0 +1,60 @@
1.4 +# Makefile - Build the Pololu IMU software
1.5 +#
1.6 +# Copyright (C) 2013 Paul Boddie
1.7 +#
1.8 +# This program is free software; you can redistribute it and/or modify
1.9 +# it under the terms of the GNU General Public License as published by
1.10 +# the Free Software Foundation; either version 2 of the License, or
1.11 +# (at your option) any later version.
1.12 +
1.13 +LIBUBB = ../ben-blinkenlights/libubb
1.14 +SYSROOT = ../openwrt-xburst/staging_dir/target-mipsel_eglibc-2.15
1.15 +TOOLBIN = ../openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.6-linaro_eglibc-2.15/bin
1.16 +
1.17 +ARCH = mipsel-openwrt-linux
1.18 +CC = $(TOOLBIN)/$(ARCH)-gcc
1.19 +
1.20 +CFLAGS = -g -Wall -fPIC -march=mips32 -I$(LIBUBB)/include $(shell $(SYSROOT)/usr/bin/sdl-config --cflags) # -DDEBUG=1
1.21 +LDFLAGS = -lm -lubb -L$(LIBUBB) $(shell $(SYSROOT)/usr/bin/sdl-config --libs) -Wl,-rpath-link,$(SYSROOT)/usr/lib -lSDL_gfx
1.22 +
1.23 +IMU = imu
1.24 +TEST = itest
1.25 +CALIBRATE = calibrate
1.26 +TARGETS = $(IMU) $(TEST) $(CALIBRATE)
1.27 +
1.28 +BASICSRC = imu.c i2c.c shutdown.c geo.c
1.29 +UISRC = measure.c ui.c gui.c
1.30 +
1.31 +IMUSRC = $(BASICSRC) $(UISRC) main.c
1.32 +IMUOBJ = $(IMUSRC:.c=.o)
1.33 +
1.34 +TESTSRC = $(BASICSRC) $(UISRC) itest.c
1.35 +TESTOBJ = $(TESTSRC:.c=.o)
1.36 +
1.37 +CALIBRATESRC = $(BASICSRC) calibrate.c
1.38 +CALIBRATEOBJ = $(CALIBRATESRC:.c=.o)
1.39 +
1.40 +ALLSRC = $(BASICSRC) $(UISRC) main.c itest.c calibrate.c
1.41 +ALLOBJ = $(ALLSRC:.c=.o)
1.42 +
1.43 +.PHONY: all clean distclean
1.44 +
1.45 +all: $(TARGETS)
1.46 +
1.47 +clean:
1.48 + rm -f $(ALLOBJ) $(TARGETS)
1.49 +
1.50 +distclean: clean
1.51 + echo "Nothing else to clean."
1.52 +
1.53 +$(IMU): $(IMUOBJ)
1.54 + $(CC) $(LDFLAGS) $(IMUOBJ) -o $@
1.55 +
1.56 +$(TEST): $(TESTOBJ)
1.57 + $(CC) $(LDFLAGS) $(TESTOBJ) -o $@
1.58 +
1.59 +$(CALIBRATE): $(CALIBRATEOBJ)
1.60 + $(CC) $(LDFLAGS) $(CALIBRATEOBJ) -o $@
1.61 +
1.62 +.c.o:
1.63 + $(CC) -c $(CFLAGS) $< -o $@