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@debian.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Pierre Habouzit 2008-07-01 21:52:38 +02:00 committed by Julien Danjou
parent e0607d7165
commit 91656b0b29

View file

@ -7,35 +7,38 @@ else
ECHO=@:
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 "$@" ..
touch ${builddir}/cmake-stamp
$(TARGETS): cmake-build
ln -s -f ${builddir}/$@ $@
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 "$(@D)" ..
awesome:
@ln -s -f ${builddir}/awesome awesome
cmake-build: ${builddir}/CMakeCache.txt
$(ECHO) "Building…"
$(MAKE) -C ${builddir}
awesome-client:
@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…"
@rm -rf ${builddir} build
$(RM) -r ${builddir} $(BUILDLN) $(TARGETS)
$(ECHO) " done"
.PHONY: clean
%:
$(ECHO) "Running make $@"
$(MAKE) -C ${builddir} $@
$(and $(filter clean,$@),$(RM) $(BUILDLN) $(TARGETS))
.PHONY: cmake-build cmake install $(BUILDLN)