############################################################################# # # Makefile for building the char-driver sample module # ############################################################################# TARGETS = winsize resize ifeq ($(DEBUG),y) CFLAGS += -O -g # -O is need to expand inlines else CFLAGS += -O2 endif PWD := $(shell pwd) GUMSTIX_BUILDROOT = $(PWD)/../gumstix-buildroot BUILD_ARM = $(wildcard $(GUMSTIX_BUILDROOT)/build_arm*) KERNELDIR ?= $(wildcard $(BUILD_ARM)/linux-*) CROSS_COMPILE = $(BUILD_ARM)/staging_dir/bin/arm-linux-uclibc- DEP_OUTPUT_OPTION = -MMD -MF $(@:.o=.d) TARGET_ARCH=-Os -march=armv5te -mtune=xscale -Wa,-mcpu=xscale CC = $(CROSS_COMPILE)gcc # # If you need additional serch paths for include files, then use the -I flag # and add them to the CPPFLAGS variable # # CPPFLAGS += -I somedir # # If you need addional search paths for library files, then use the -L flag # and add them to LDFLAGS. # # LDFLAGS += -L somedir # # If you need additional libraries, then use -lxxx to search for libxxx.a # # LDFLAGS += -lxxx .PHONY: all all: $(TARGETS) # # You can change the $(TARGET).c if that's not your main file and you can # add additional .o files to the end of the line # SRCS = $(addsuffix .c,$(TARGETS)) OBJS = $(SRCS:.c=.o) DEPS = $(OBJS:.o=.d) $(TARGETS) : % : %.o # Compile and produce the .d file at the same time %.o : %.c %.d $(COMPILE.c) $(DEP_OUTPUT_OPTION) $(OUTPUT_OPTION) $< # Making the .d's be phony and providing a dummy rule to make them, combined # with the %.o : %.c %.d causes make to work properly when the .d file is # removed, but the .o file isn't. make will now regenerate the .d by # recompiling the .o .PHONY: %.d %.d: ; clean: rm -rf $(OBJS) core $(TARGETS) ifneq ($(DEP_FILES),) ifeq ($(strip $(filter clean%, $(MAKECMDGOALS))),) -include $(DEP_FILES) endif endif