参考一个makefile就行啊。
#THe Newest Modify Time: 2013-01-20
# DVSDK4.0.1 DIR
DVSDK_DIR = /home/dvsdk4_01
include $(DVSDK_DIR)/Rules.make
# Comment this out if you want to see full compiler and linker output.
override VERBOSE = @
TARGET = sys
INSTALL_DIR = /home/BeagleBoard/rootfs/usr/share/run_bin
# use CROSS_COMPILE arm-none-linux-gnueabi-gcc
C_FLAGS += -Wall -g
CPP_FLAGS += -I$(LINUXKERNEL_INSTALL_DIR)/include -I$(LINUXKERNEL_INSTALL_DIR)/arch/arm/include
CPP_FLAGS += -I../commom_lib/include
LD_FLAGS += -L$(LINUXLIBS_INSTALL_DIR)/lib -L/opt/DigitalPersona/lib_arm -L../commom_lib/lib\
-ldpfpdd -ldpfj \
-lipc_socket -lipc_sem -lipc_shm -lsys_log -lfd_poll \
-Wl,-rpath,/usr/lib/lib_finger:/usr/lib/lib_ipc\
-lm -lc -lpthread
GCC_COMPILE = $(CSTOOL_PREFIX)gcc $(C_FLAGS) $(CPP_FLAGS) -c
GCC_LINK = $(CSTOOL_PREFIX)gcc $(LD_FLAGS)
# Source file *.c,*.h
SOURCES = $(wildcard *.c)
HEADERS = $(wildcard *.h)
# Object file *.o
OBJFILES = $(patsubst %.c,%.o,$(SOURCES))
#OBJFILES = $(SOURCES:%.c=%.o)
#Command For Build
all: $(TARGET) install
$(TARGET): $(OBJFILES)
@echo
@echo Linking $@ from $^..
$(GCC_LINK) $^ -o $@
$(OBJFILES): %.o:%.c $(HEADERS)
@echo
@echo Compiling $@ from $<..
$(GCC_COMPILE) $< -o $@
.PHONY: install clean
install:
@echo
@echo Install $(TARGET)..
mkdir -p $(INSTALL_DIR)
install $(TARGET) $(INSTALL_DIR)
clean:
@echo Removing generated files..
rm -f $(INSTALL_DIR)/$(TARGET) $(TARGET) *.o *~