# Makefile for YAFFS direct test # # # YAFFS: Yet another Flash File System. A NAND-flash specific file system. # # Copyright (C) 2003 Aleph One Ltd. # # # Created by Charles Manning # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # NB Warning this Makefile does not include header dependencies. # # $Id: Makefile,v 1.20 2008-11-11 01:48:47 charles Exp $ # Invoke this Makefile normally if you want to build the executables # # For building a cross-compiled library, invoke as follows: # # $ make CC= CFLAGS= AR= lib # # You *must* include in your CFLAGS: # -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2 -DCONFIG_YAFFS_PROVIDE_DEFS # # You may have to optionally add: # RANLIB= # MAKEDEPEND=, should generate bla.d for bla.c. # Unnecessary if your compiler is gcc (or arch-fmt-gcc). # Set default for CC CC = gcc #EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC CFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2 CFLAGS += -DCONFIG_YAFFS_PROVIDE_DEFS -DCONFIG_YAFFSFS_PROVIDE_VALUES -DNO_Y_INLINE CFLAGS += -Wall -g $(EXTRA_COMPILE_FLAGS) -Wstrict-aliasing #CFLAGS += -fno-strict-aliasing CFLAGS += -O3 #CFLAGS += -DVALGRIND_TEST #CFLAGS+= -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations #CFLAGS+= -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline DIRECT_OBJ = DIRECT_OBJ += yaffsfs.o MAIN_OBJ = MAIN_OBJ += yaffs_fileem.o MAIN_OBJ += yaffs_fileem2k.o MAIN_OBJ += yaffs_ramdisk.o MAIN_OBJ += yaffs_ramem2k.o MAIN_OBJ += yaffscfg2k.o MAIN_OBJ += dtest.o COMMON_OBJ = COMMON_OBJ += yaffs_ecc.o COMMON_OBJ += yaffs_guts.o COMMON_OBJ += yaffs_packedtags1.o COMMON_OBJ += yaffs_tagscompat.o COMMON_OBJ += yaffs_packedtags2.o COMMON_OBJ += yaffs_tagsvalidity.o COMMON_OBJ += yaffs_nand.o COMMON_OBJ += yaffs_checkptrw.o COMMON_OBJ += yaffs_qsort.o # COMMON_OBJ += yaffs_checkptrwtest.o BOOTTESTOBJS = yaffs_fileem.o # bootldtst.o yboot.o nand_ecc.o YAFFSTESTOBJS = $(COMMONTESTOBJS) yaffs_test.o DIRECT_LIB_OBJ = $(DIRECT_OBJ) $(COMMON_OBJ) ALLOBJS = $(DIRECT_LIB_OBJ) $(BOOTTESTOBJS) $(MAIN_OBJ) LIB = libyaffs.a #all: directtest2k boottest all: directtest2k yaffs_test %.o : %.c $(CC) -c $(CFLAGS) -o $@ $< $(COMMON_OBJ): %.o: ../%.c $(CC) -c $(CFLAGS) -o $@ $< directtest2k: $(DIRECT_LIB_OBJ) $(MAIN_OBJ) $(CC) -o $@ $(DIRECT_LIB_OBJ) $(MAIN_OBJ) lib: $(LIB) $(LIB): $(DIRECT_LIB_OBJ) $(AR) rcs $@ $(DIRECT_LIB_OBJ) ifneq ($(RANLIB), ) $(RANLIB) $@ endif yaffs_test: $(YAFFSTESTOBJS) $(CC) -o $@ $(YAFFSTESTOBJS) boottest: $(BOOTTESTOBJS) $(CC) -o $@ $(BOOTTESTOBJS) clean: rm -f $(ALLOBJS) core $(DEPS) # From the cheatsheet: if we use gcc, then we know how to makedepend ifeq (gcc, $(patsubst %gcc, gcc, $(CC))) MAKEDEPEND = $(CC) -MM -MD -E endif ifneq (, $(MAKEDEPEND)) %.d : %.c $(MAKEDEPEND) $(CFLAGS) $< -o $@ C_FILES = C_FILES += $(patsubst %.o, %.c, $(DIRECT_OBJ)) C_FILES += $(patsubst %.o, %.c, $(BOOTTESTOBJS)) C_FILES += $(patsubst %.o, %.c, $(MAIN_OBJ)) C_FILES += $(patsubst %.o, ../%.c, $(COMMON_OBJ)) DEPS = $(patsubst %.c, %.d, $(C_FILES)) include $(DEPS) endif