之前寫的Makefile 范例。兩個版本,For PC and Cross compile,以後直接用這個模板。
include $(CLEAR_VARS)
INCLUDE = -I. -I../include -I../zlib \
CFLAGS = $(INCLUDE)
#FOR PC compile
#LIBS = -L/usr/lib/i386-linux-gnu -lpthread
#CC=gcc
#FOR cross compile
LIBS = -L/armrootfs/usr/lib -lrt -lpthread \
-L../libcutils -lcutils -L../libzipfile -lzipfile -L../zlib -lunz
CC=arm-fsl-linux-gnueabi-gcc
OBJS = centraldir.o \
zipfile.o
#libzipfile.a: $(OBJS)
# ar -rv libzipfile.a $?
libzipfile.so: $(OBJS)
$(CC) -shared -o libzipfile.so $?
centraldir.o: centraldir.c private.h
$(CC) $(CFLAGS) -c centraldir.c
zipfile.o: zipfile.c private.h
$(CC) $(CFLAGS) -c zipfile.c
clean:
rm -rf *.o libzipfile.so