[PATCH] Revamp the toplevel Makefile.
This fixes among things:
* cmake has a clean target that doesn't redo cmake, use it, implement
distclean for what clean did.
* cmake is aware that it has to reconfigure, let id be clever about that
instead of being half clever ourselves.
* Don't have a *build* symlink and a *build* target, this is confusing.
* Forward things we don't know about to cmake.
Signed-off-by: Pierre Habouzit <madcoder@...>
---
Makefile | 47 +++++++++++++++++++++++++----------------------
1 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/Makefile b/Makefile
index 425d6fe..d4ed269 100644
--- a/Makefile
+++ b/Makefile
<at> <at> -7,35 +7,38 <at> <at> else
ECHO= <at> :
endif
-all: cmake
- $(ECHO) "Buildingâ¦"
- $(MAKE) -C build
+TARGETS=awesome awesome-client
+BUILDLN=build
-install: cmake
- $(ECHO) "Installingâ¦"
- $(MAKE) -C build install
+all: $(TARGETS) $(BUILDLN)
-cmake: build/cmake-stamp
-build/cmake-stamp: build CMakeLists.txt awesomeConfig.cmake
- $(ECHO) "Running cmakeâ¦"
- cd ${builddir} && cmake "$ <at> " ..
- touch ${builddir}/cmake-stamp
+$(TARGETS): cmake-build
+ ln -s -f ${builddir}/$ <at> $ <at>
-build: awesome awesome-client
- $(ECHO) -n "Creating new build directoryâ¦"
+$(BUILDLN):
+ ln -s -f ${builddir} $(BUILDLN)
+
+cmake ${builddir}/CMakeCache.txt:
mkdir -p ${builddir}
- ln -s -f ${builddir} build
- $(ECHO) " done"
+ $(ECHO) "Running cmakeâ¦"
+ cd ${builddir} && cmake "$( <at> D)" ..
-awesome:
- <at> ln -s -f ${builddir}/awesome awesome
+cmake-build: ${builddir}/CMakeCache.txt
+ $(ECHO) "Buildingâ¦"
+ $(MAKE) -C ${builddir}
-awesome-client:
- <at> ln -s -f ${builddir}/awesome-client awesome-client
+install: cmake-build
+ $(ECHO) "Installingâ¦"
+ $(MAKE) -C ${builddir} install
-clean:
+distclean:
$(ECHO) -n "Cleaning up build directoryâ¦"
- <at> rm -rf ${builddir} build
+ $(RM) -r ${builddir} $(BUILDLN) $(TARGETS)
$(ECHO) " done"
-.PHONY: clean
+%:
+ $(ECHO) "Running make $ <at> â¦"
+ $(MAKE) -C ${builddir} $ <at>
+ $(and $(filter clean,$ <at> ),$(RM) $(BUILDLN) $(TARGETS))
+
+.PHONY: cmake-build cmake install $(BUILDLN)
--
--
1.5.6.1.218.g2294e