From 02e839406c6986c46b8a2763b1b4c3f055f088cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Fri, 23 Aug 2013 22:56:58 +0200 Subject: [PATCH] Factorized common qmake parts --- src/common.pri | 12 +++++++++++ src/common_post.mk | 35 --------------------------------- src/common_pre.mk | 11 ----------- src/controlling/controlling.pro | 13 ++---------- src/editing/editing.pro | 13 ++---------- src/exploring/exploring.pro | 13 ++---------- src/rendering/rendering.pro | 13 ++---------- src/testing/testing.pro | 13 ++---------- 8 files changed, 22 insertions(+), 101 deletions(-) create mode 100644 src/common.pri delete mode 100644 src/common_post.mk delete mode 100644 src/common_pre.mk diff --git a/src/common.pri b/src/common.pri new file mode 100644 index 0000000..0e2e84c --- /dev/null +++ b/src/common.pri @@ -0,0 +1,12 @@ +INCLUDEPATH += .. + +CONFIG(debug) { + DESTDIR = ../../build/debug/ + MAKEFILE = Makefile.debug +} else { + DESTDIR = ../../build/release/ + MAKEFILE = Makefile.release +} + +release:DEFINES += NDEBUG + diff --git a/src/common_post.mk b/src/common_post.mk deleted file mode 100644 index 14bc9d6..0000000 --- a/src/common_post.mk +++ /dev/null @@ -1,35 +0,0 @@ -OBJECTS = ${SOURCES:%.c=${OBJPATH}/%.o} - -ifeq (${BUILDMODE},debug) - CC_FLAGS += -g - CC_LDFLAGS += -g -endif -ifeq (${BUILDMODE},release) - CC_FLAGS += -O3 -DNDEBUG -Wno-unused-variable -Wno-unused-but-set-variable -endif - -ifneq (,${LIBS}) - CC_FLAGS += $(shell pkg-config --cflags ${LIBS}) - CC_LDFLAGS += $(shell pkg-config --libs ${LIBS}) -endif - -CC_FLAGS += -fPIC -Wall -I${PROJECT_PATH}/src -CC_LDFLAGS += -fPIC -lm - -all:prepare ${RESULT} - -prepare: - mkdir -p ${BUILDPATH} - -clean: - rm -f ${OBJECTS} - rm -f ${RESULT} - -${OBJPATH}/%.o:%.c ${HEADERS} - mkdir -p `dirname $@` - ${CC} -c ${CC_FLAGS} $< -o $@ - -${RESULT}:${OBJECTS} - ${CC} $^ ${CC_LDFLAGS} -o $@ - -.PHONY:all clean prepare diff --git a/src/common_pre.mk b/src/common_pre.mk deleted file mode 100644 index 678892b..0000000 --- a/src/common_pre.mk +++ /dev/null @@ -1,11 +0,0 @@ -ifeq ($(strip $(BUILDMODE)),) - exit 1 -endif -ifeq ($(strip $(PROJECT_PATH)),) - exit 1 -endif - -PATH_LIB_PAYSAGES = ${PROJECT_PATH}/rendering -BUILDMODE = debug -BUILDPATH = ${PROJECT_PATH}/build/${BUILDMODE} -HEADERS = $(${PATH_LIB_PAYSAGES}/atmosphere/*.h ${PATH_LIB_PAYSAGES}/clouds/*.h ${PATH_LIB_PAYSAGES}/terrain/*.h ${PATH_LIB_PAYSAGES}/textures/*.h ${PATH_LIB_PAYSAGES}/water/*.h ${PATH_LIB_PAYSAGES}/tools/*.h ${PATH_LIB_PAYSAGES}/shared/*.h) diff --git a/src/controlling/controlling.pro b/src/controlling/controlling.pro index 275a91f..672bc41 100644 --- a/src/controlling/controlling.pro +++ b/src/controlling/controlling.pro @@ -1,23 +1,14 @@ +include(../common.pri) + TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG -= qt TARGET = paysages-cli -INCLUDEPATH += .. - -CONFIG(debug) { - DESTDIR = ../../build/debug/ - MAKEFILE = Makefile.debug -} else { - DESTDIR = ../../build/release/ - MAKEFILE = Makefile.release -} OBJECTS_DIR = $$DESTDIR/controlling/ -release:DEFINES += NDEBUG - DEPENDPATH += .. linux-clang:LIBS += -L$$DESTDIR -lpaysages_rendering diff --git a/src/editing/editing.pro b/src/editing/editing.pro index f5f334f..fdc4810 100644 --- a/src/editing/editing.pro +++ b/src/editing/editing.pro @@ -1,24 +1,15 @@ +include(../common.pri) + TEMPLATE = app CONFIG += qt QT += core gui opengl TARGET = paysages-gui -INCLUDEPATH += .. - -CONFIG(debug) { - DESTDIR = ../../build/debug/ - MAKEFILE = Makefile.debug -} else { - DESTDIR = ../../build/release/ - MAKEFILE = Makefile.release -} OBJECTS_DIR = $$DESTDIR/editing/ MOC_DIR = $$OBJECTS_DIR/moc/ -release:DEFINES += NDEBUG - DEPENDPATH += .. linux-clang:LIBS += -L$$DESTDIR -lpaysages_rendering -lpaysages_exploring -lGLU win32:LIBS += ../../libpaysages.a -lDevIL -lILU -lILUT -lglib-2.0 -lgthread-2.0 diff --git a/src/exploring/exploring.pro b/src/exploring/exploring.pro index 88cf1aa..b161513 100644 --- a/src/exploring/exploring.pro +++ b/src/exploring/exploring.pro @@ -1,23 +1,14 @@ +include(../common.pri) + TEMPLATE = lib CONFIG += console CONFIG -= app_bundle CONFIG -= qt TARGET = paysages_exploring -INCLUDEPATH += .. - -CONFIG(debug) { - DESTDIR = ../../build/debug/ - MAKEFILE = Makefile.debug -} else { - DESTDIR = ../../build/release/ - MAKEFILE = Makefile.release -} OBJECTS_DIR = $$DESTDIR/exploring/ -release:DEFINES += NDEBUG - SOURCES += main.c \ terrain.c \ sky.c \ diff --git a/src/rendering/rendering.pro b/src/rendering/rendering.pro index 9e82c03..3b43e57 100644 --- a/src/rendering/rendering.pro +++ b/src/rendering/rendering.pro @@ -1,23 +1,14 @@ +include(../common.pri) + TEMPLATE = lib CONFIG += console CONFIG -= app_bundle CONFIG -= qt TARGET = paysages_rendering -INCLUDEPATH += .. - -CONFIG(debug) { - DESTDIR = ../../build/debug/ - MAKEFILE = Makefile.debug -} else { - DESTDIR = ../../build/release/ - MAKEFILE = Makefile.release -} OBJECTS_DIR = $$DESTDIR/rendering/ -release:DEFINES += NDEBUG - linux-clang { CONFIG += link_pkgconfig PKGCONFIG += glib-2.0 gthread-2.0 IL ILU diff --git a/src/testing/testing.pro b/src/testing/testing.pro index 586e53e..8b51998 100644 --- a/src/testing/testing.pro +++ b/src/testing/testing.pro @@ -1,23 +1,14 @@ +include(../common.pri) + TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG -= qt TARGET = paysages-tests -INCLUDEPATH += .. - -CONFIG(debug) { - DESTDIR = ../../build/debug/ - MAKEFILE = Makefile.debug -} else { - DESTDIR = ../../build/release/ - MAKEFILE = Makefile.release -} OBJECTS_DIR = $$DESTDIR/testing/ -release:DEFINES += NDEBUG - linux-clang { CONFIG += link_pkgconfig PKGCONFIG += check