CROSS_COMPILE =
HI_CFLAGS= -Wall -O2 -g -march=armv7-a -mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=vfpv3-d16
 
CC=$(CROSS_COMPILE)gcc
AR=$(CROSS_COMPILE)ar  
LD=$(CROSS_COMPILE)ld
 
export CROSS_COMPILE CC AR LD
 
PWD = $(shell pwd)
SRCDIR = $(PWD)/src
CFG_INC = $(PWD)/include
 
 
objs := $(patsubst %.c,%.o,$(wildcard $(SRCDIR)/*.c))
#objs := $(SRCDIR)/src_1.o\
    $(SRCDIR)/src_2.o
 
objs_clean := $(objs)
 
SLIB=$(PWD)/lib/libdemo.a
DLIB=$(PWD)/lib/libdemo.so
 
target= $(SLIB) $(DLIB)
 
all: $(target)
    @echo "build ok!"
 
$(DLIB): ${objs}
    $(CC) -shared -o $@ $(objs)
 
$(SLIB): ${objs}
    $(AR) -rc $@ $(objs)
 
%.o : %.c
    $(CC) $(HI_CFLAGS) -I$(CFG_INC) -c -fPIC -o "$@" "$<"  
 
clean:
    rm -f $(objs_clean)
    @rm -f $(target)
    @echo "clean ok!"

05-19 03:28