Use wildcard and filter-out instead of find.

This commit is contained in:
Sebastian Ramacher 2012-03-08 17:50:54 +01:00
parent b1893b47a2
commit 48d06cbf36
2 changed files with 12 additions and 7 deletions

View file

@ -4,14 +4,16 @@ include config.mk
include common.mk include common.mk
PROJECT = zathura PROJECT = zathura
OSOURCE = $(shell find . -maxdepth 1 -iname "*.c" -a ! -iname "database-sqlite.c") OSOURCE = $(wildcard *.c)
HEADER = $(shell find . -maxdepth 1 -iname "*.h") HEADER = $(wildcard *.h)
ifneq (${WITH_SQLITE},0) ifneq (${WITH_SQLITE},0)
INCS += $(SQLITE_INC) INCS += $(SQLITE_INC)
LIBS += $(SQLITE_LIB) LIBS += $(SQLITE_LIB)
SOURCE = $(OSOURCE) database-sqlite.c SOURCE = $(OSOURCE)
CPPFLAGS += -DWITH_SQLITE CPPFLAGS += -DWITH_SQLITE
else
SOURCE = $(filter-out database-sqlite.c,$(OSOURCE))
endif endif
ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),) ifneq ($(wildcard ${VALGRIND_SUPPRESSION_FILE}),)
@ -91,7 +93,7 @@ dist: clean
$(QUIET)mkdir -p ${PROJECT}-${VERSION}/po $(QUIET)mkdir -p ${PROJECT}-${VERSION}/po
$(QUIET)cp LICENSE Makefile config.mk common.mk README AUTHORS Doxyfile \ $(QUIET)cp LICENSE Makefile config.mk common.mk README AUTHORS Doxyfile \
${PROJECT}.1.rst ${PROJECT}rc.5.rst ${OSOURCE} ${HEADER} ${PROJECT}.pc.in \ ${PROJECT}.1.rst ${PROJECT}rc.5.rst ${OSOURCE} ${HEADER} ${PROJECT}.pc.in \
${PROJECT}.desktop version.h.in database-sqlite.c \ ${PROJECT}.desktop version.h.in \
${PROJECT}-${VERSION} ${PROJECT}-${VERSION}
$(QUIET)cp tests/Makefile tests/config.mk tests/*.c \ $(QUIET)cp tests/Makefile tests/config.mk tests/*.c \
${PROJECT}-${VERSION}/tests ${PROJECT}-${VERSION}/tests

View file

@ -8,18 +8,21 @@ PROJECT = tests
SOURCE = tests.c $(wildcard test_*.c) SOURCE = tests.c $(wildcard test_*.c)
OBJECTS = ${SOURCE:.c=.o} OBJECTS = ${SOURCE:.c=.o}
ZSOURCE = $(shell find ../ -maxdepth 1 -iname "*.c" -a ! -iname "database-sqlite.c" ! -iname "main.c") ZOSOURCE = $(filter-out ../main.c,$(wildcard ../*.c))
ZOBJECTS = ${ZSOURCE:.c=.o}
ifneq (${WITH_SQLITE},0) ifneq (${WITH_SQLITE},0)
INCS += $(SQLITE_INC) INCS += $(SQLITE_INC)
LIBS += $(SQLITE_LIB) LIBS += $(SQLITE_LIB)
ZSOURCE += ../database-sqlite.c ZSOURCE += $(ZOSOURCE)
ifeq (,$(findstring -DWITH_SQLITE,${CPPFLAGS})) ifeq (,$(findstring -DWITH_SQLITE,${CPPFLAGS}))
CPPFLAGS += -DWITH_SQLITE CPPFLAGS += -DWITH_SQLITE
endif endif
else
ZSOURCE = $(filter-out database-sqlite.c,$(ZOSOURCE))
endif endif
ZOBJECTS = ${ZSOURCE:.c=.o}
all: ${PROJECT} all: ${PROJECT}
run: ${PROJECT} run: ${PROJECT}