diff --git a/tools/reader/Makefile b/tools/reader/Makefile index 61e6aad..6b5ed87 100644 --- a/tools/reader/Makefile +++ b/tools/reader/Makefile @@ -1,11 +1,32 @@ -CC = gcc +ifneq "$(TUPLE)" "" +PREFIX=$(TUPLE)- +ARCH=$(shell echo $(TUPLE)|sed 's/-.*//') +else +PREFIX= +ARCH=$(shell uname -m) +endif + +CC = $(PREFIX)gcc +STRIP = $(PREFIX)strip + CFLAGS = -Wall -O2 EXE = obreader FILES = obreader.c -OBJS = obreader.o -all: $(FILES) - $(CC) $(CFLAGS) $(FILES) -o $(EXE) +$(ARCH)-$(EXE): + $(CC) $(CFLAGS) -o $@ $(FILES) + $(STRIP) $@ + + +# Using OpenWRT crossbuild environment, see +# +# for setup instructions. +WRT=~/r0ket/openwrt/trunk/staging_dir + +mips: + STAGING_DIR=$(WRT)/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2 \ + PATH=${PATH}:$(STAGING_DIR)/bin \ + $(MAKE) TUPLE=mips-openwrt-linux clean: - rm -f $(EXE) $(OBJS) + rm -f *-$(EXE)