# Beryl Makefile. # # (C) 2006 Quinn_Storm, Nigel Cunningham and others. # # Thanks to DBO for some good ideas. # # Targets: # # update: Run svn update. # configure: Run autogen for each package. # build: Build each package, installing what is needed for prerequisites. # rebuild: Rerun building packages. # usrlocalcheck: Check for binaries in /usr/local. # debs: Build Debian packages, installing with sudo along the way. # install: Install modules from source. # uninstall: Remove modules previously installed from source. # clean: Cleanup. # distclean: Cleanup thoroughly. # all: Build and install everything from source. # all-debs: Build and install everything as debs. # install-debug: Install debug versions of core and plugins. # # Per package targets: # (Replace $NAME with one of the names from modules below). # # $NAME.clean Clean a single package. # $NAME.newdeb (Re)build a deb. # $NAME.build Build but don't install a single package. # $NAME.rebuild (Re)build a package. # $NAME.install Rebuild and install a single package from source. # $NAME.uninstall Remove a package previously installed from source. # # The checked-out tree is copied to .$NAME.build for building, so any # mistakes in cleaning up etc won't accidentally delete your precious files. # PREFIX?=/usr/local SUCMD?=sudo CFLAGS?=-O2 -Wall -ggdb3 -gstabs+ EXTRA_PACKAGE_ARGS=-us -uc SVNVER:=$(shell svn info | head -5 | tail -1 | awk -F ': ' '{ print $$2 }') TRUNKDIR:=$(shell pwd) COOKIEDIR=cookies .PRECIOUS: $(COOKIEDIR)/%.cfg $(COOKIEDIR)/%.built $(COOKIEDIR)/%.deb $(COOKIEDIR)/%.deb-installed $(COOKIEDIR)/%.installed ifeq ($(QUIET),1) REDIRECT=>>$(TRUNKDIR)/$*.log 2>&1 else REDIRECT=2>&1 | tee -a $(TRUNKDIR)/$*.log endif modules:=\ beryl-core \ beryl-dbus \ beryl-plugins \ beryl-settings \ beryl-manager \ emerald \ emerald-themes \ heliodor cfgmodules:=$(patsubst %,$(COOKIEDIR)/%.cfg,$(modules)) buildmodules:=$(patsubst %,$(COOKIEDIR)/%.built,$(modules)) installmodules:=$(patsubst %,$(COOKIEDIR)/%.installed,$(modules)) uninstallmodules:=$(patsubst %,$(COOKIEDIR)/%.uninstall,$(modules)) cleanmodules:=$(patsubst %,$(COOKIEDIR)/%.clean,$(modules)) debmodules:=$(patsubst %,$(COOKIEDIR)/%.deb,$(modules)) debinstalls:=$(patsubst %,$(COOKIEDIR)/%.deb-installed,$(modules)) all: update $(buildmodules) all-debs: update debs $(COOKIEDIR)/beryl-plugins.deb $(COOKIEDIR)/emerald.deb: $(COOKIEDIR)/beryl-core.deb-installed $(COOKIEDIR)/beryl-settings.deb: $(COOKIEDIR)/beryl-plugins.deb-installed $(COOKIEDIR)/beryl-plugins.built $(COOKIEDIR)/emerald.built: $(COOKIEDIR)/beryl-core.installed beryl: update distclean $(COOKIEDIR)/beryl-core.build $(COOKIEDIR)/beryl-plugins.build usrlocalcheck: for i in beryl beryl-xgl beryl-settings beryl-manager \ beryl-settings-dump \ emerald emerald-theme-manager; do \ if [ -f /usr/local/bin/$$i ]; then \ echo "Found probably old $$i in /usr/local/bin/$$i"; \ echo " you should remove that, if you don't know exactly why it is there"; \ fi; \ done; cookies: mkdir cookies update: @svn up @make distclean $(COOKIEDIR)/%.clean: @echo "==> Cleaning $* build." @rm -rf .$*.build || /bin/true @mkdir -p $(COOKIEDIR) || /bin/true @rm -f $(COOKIEDIR)/$** @touch $@ $(COOKIEDIR)/%.cfg: $(COOKIEDIR)/%.clean @echo "==> Configuring $* build." @rm -f $(COOKIEDIR)/$*.clean @cp -ar $* .$*.build $(REDIRECT) @sh -c 'cd .$*.build;./autogen.sh --prefix=$(PREFIX) CFLAGS="$(CFLAGS)"' $(REDIRECT) @mkdir -p $(COOKIEDIR) || /bin/true @touch $@ $(COOKIEDIR)/%.deb: $(COOKIEDIR)/%.cfg @echo "==> Building $* debian package." @if [ -d distro-specific-build-files/$*/debian ]; then \ cp -ar distro-specific-build-files/$*/debian .$*.build $(REDIRECT); \ fi @sed "1 s/-svn[0-9]*)/)/" -i .$*.build/debian/changelog @sed "1 s/)/-svn${SVNVER})/" -i .$*.build/debian/changelog @rm -f $(COOKIEDIR)/$*.debdone || /bin/true @sh -c 'cd .$*.build; dpkg-buildpackage -rfakeroot $(EXTRA_PACKAGE_ARGS) && touch ../$(COOKIEDIR)/$*.deb' $(REDIRECT); @sed "1 s/-svn[0-9]*)/)/" -i .$*.build/debian/changelog $(COOKIEDIR)/%.deb-installed: $(COOKIEDIR)/%.deb @echo "==> Installing $* debian packages." @$(SUCMD) dpkg -i *.deb $(REDIRECT) @mkdir -p output/${SVNVER} @mv -f *.deb *.changes *.tar.gz *.dsc *.log output/${SVNVER} @touch $@ @touch $(COOKIEDIR)/$*.installed $(COOKIEDIR)/%.newdeb: $(COOKIEDIR)/%.clean @make $(COOKIEDIR)/$*.deb-installed @/bin/true $(COOKIEDIR)/%.built: $(COOKIEDIR)/%.cfg @echo "==> Building $*." @make -C .$*.build $(REDIRECT) @touch $@ $(COOKIEDIR)/%.installed: $(COOKIEDIR)/%.built @echo "==> Installing $*." @$(SUCMD) make -C .$*.build install $(REDIRECT) @touch $@ $(COOKIEDIR)/%.uninstall: $(COOKIEDIR)/%.cfg @echo "==> Uninstalling $*." @$(SUCMD) make -C .$*.build uninstall $(REDIRECT) @rm -f $(COOKIEDIR)/$*.installed %.clean: $(COOKIEDIR)/%.clean @/bin/true %.build: $(COOKIEDIR)/%.built @/bin/true %.rebuild: %.clean make $(COOKIEDIR)/$*.built %.install: $(COOKIEDIR)/%.build @make $(COOKIEDIR)/$*.installed %.uninstall: $(COOKIEDIR)/*.build @make $(COOKIEDIR)/$* %.deb: $(COOKIEDIR)/%.clean $(COOKIEDIR)/%.deb-installed @/bin/true %.newdeb: $(COOKIEDIR)/%.newdeb @/bin/true configure: $(cfgmodules) configure-beryl: beryl-core.cfg beryl-plugins.cfg install: $(installmodules) uninstall: $(uninstallmodules) clean: $(cleanmodules) @/bin/true build: $(buildmodules) debs: $(debinstalls) newdebs: distclean debs distclean: clean @rm -f *.changes *.deb *.tar.gz *.dsc install-debug: $(COOKIEDIR)/beryl-core.deb $(COOKIEDIR)/beryl-plugins.deb if [ -z "${PREFIX}" ] ; then PREFIX=/usr/local ; fi; \ sudo mkdir -p ${PREFIX}/bin; \ sudo mkdir -p ${PREFIX}/lib/beryl/backends; \ sudo cp .beryl-core.build/src/beryl-xgl ${PREFIX}/bin ; \ sudo cp .beryl-core.build/libberylsettings/.libs/libberylsettings.so ${PREFIX}/lib ; \ sudo cp .beryl-core.build/settings-backends/.libs/libini.so ${PREFIX}/lib/beryl/backends/ ; \ sudo cp .beryl-plugins.build/src/.libs/*.so ${PREFIX}/lib/beryl/ ; \ cfg-clean: @rm -f $(COOKIEDIR)/*.cfg