###################################################################
# 通用makefile
# ChenWenDong
###################################################################
MINIGUI_DIR = /opt/z1/miniGUI_3.0.12/output
CROSS_DIR = /usr/local/arm_linux_4.2
CROSS = arm-linux-
SRCDIRS = ./camera ./hal ./app ./timer
ASFLAGS =
CFLAGS = -O2 -Wall
CXXFLAGS =
LDFLAGS =
ARFLAGS =
OCFLAGS =
ODFLAGS =
INCDIRS = -I$(MINIGUI_DIR)/include/freetype2 \
-I$(MINIGUI_DIR)/include \
-I$(CROSS_DIR)/arm-linux/include \
-I$(CROSS_DIR)/arm-none-linux-gnueabi/include
LIBDIRS = -L$(MINIGUI_DIR)/lib \
-L$(CROSS_DIR)/arm-none-linux-gnueabi/lib
LIBS = -lminigui_ths -lfreetype -ljpeg -lpng -ldl -lm -lpthread -muclibc
#
### You shouldn't need to change anything below this point.
#
##
#AS = $(CROSS)as
CC = $(CROSS)gcc
CXX = $(CROSS)g++
LD = $(CROSS)gcc
AR = $(CROSS)ar
OC = $(CROSS)objcopy
OD = $(CROSS)objdump
RM = -rm -fr
NAME := z1 #$(notdir $(CURDIR))
SFILES := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.s))
CFILES := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.c))
CPPFILES := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.cpp))
RMFILES := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*~))
RMFILEO := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.o))
OBJS := $(SFILES:.s=.o) $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
DEPS := $(OBJS:.o=.d)
VPATH := $(SRCDIRS)
.PHONY: all rebuild clean
all:
@$(MAKE) $(NAME)
rebuild:
@$(MAKE) clean
@$(MAKE) $(NAME)
$(NAME):$(OBJS)
@echo test linking ...
$(LD) $(LDFLAGS) $(LIBDIRS) -o $@ $^ $(LIBS)
%.o: %.s
@echo assembling $< ...
$(AS) $(ASFLAGS) $(INCDIRS) $< -o $@
%.o: %.c
@echo test compiling $< ...
$(CC) $(CFLAGS) $(INCDIRS) -c $< -o $@
%.o: %.cpp
@echo compiling $< ...
$(CXX) $(CXXFLAGS) $(INCDIRS) -c $< -o $@
%.d: %.c
@$(CC) $(CFLAGS) $(INCDIRS) -MM $^ -o $@.tmp
@sed 's,$(basename $(notdir $@)).o[ :]*,$(@:.d=.o) $@ : ,g' $@.tmp > $@
@$(RM) $@.tmp
%.d: %.cpp
@$(CXX) $(CXXFLAGS) $(INCDIRS) -MM $^ -o $@.tmp
@sed 's,$(basename $(notdir $@)).o[ :]*,$(@:.d=.o) $@ : ,g' $@.tmp > $@
@$(RM) $@.tmp
ifeq (mach/mach,)
-include $(DEPS)
endif
clean:
@$(RM) $(OBJS) $(DEPS) $(NAME) $(RMFILES) $(RMFILEO)
@echo clean completed
离线