2009年9月10日木曜日

Sample Makefile for OpenWrt

# makefile for Linux x86 and OpenWrt
#
# Makefile, v 0.01 2009/09/04 patinya

ifdef NOCROSSBUILD
ifeq ($(NOCROSSBUILD),0)
CC=mipsel-linux-gcc
LD=mipsel-linux-ld
AR=mipsel-linux-ar
RANLIB=mipsel-linux-uclibc-ranlib
CXX=mipsel-linux-g++
else
CC=gcc
LD=cc
AR=ar
RANLIB=ranlib
CXX=g++
endif
else
CC=mipsel-linux-gcc
LD=mipsel-linux-ld
AR=mipsel-linux-ar
RANLIB=mipsel-linux-uclibc-ranlib
CXX=mipsel-linux-g++
endif

INCLUDES=-I/opt/OpenWrt/devkit/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/include/
CFLAGS=-g -Wall -O2 -static

SRCS=hello.c
TARGET=hello

all: $(TARGET)
echo "Compling ..."
$(CC) $(CFLAGS) $(INCLUDES) -o $(TARGET) $(SRCS)

clean:
echo "Remove obj file ..."
rm -f *.o $(TARGET)

0 件のコメント: