# # Makefile # # Developed by Lubomir Host 'rajo' # Copyright (c) 2007 Platon Group, http://platon.sk/ # Licensed under terms of GNU General Public License. # All rights reserved. # # Changelog: # 2007-02-11 - created # # $Platon$ # Makefile for creating distribution of test package # Type 'make dist' for create tar-gziped archiv. PACKAGE = thinkpad-status VERSION = 0.1 unexport SUBDIRS unexport SUBDIR_OBJECTS unexport MAKEFILES unexport CONFIGURE_SCRIPTS export PACKAGE export VERSION # Directories {{{ srcdir = . top_srcdir = . distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) top_builddir = . # }}} Directories # Targets {{{ # if you have subdirectories with Makefiles, # add names of directories here SUBDIRS = PROGRAM = thinkpad-status DOCS = \ AUTHORS \ ChangeLog \ INSTALL \ NEWS \ README SOURCES = \ thinkpad.glade \ thinkpad.gladep \ thinkpad.pl DISTFILES = Makefile \ $(DOCS) \ $(SOURCES) \ $(PROGRAM) # }}} Targets # Programs {{{ TAR = tar ZIP = zip ZIP_ENV = -r9 GZIP_ENV = --best # }}} Programs all: $(PROGRAM) $(PROGRAM): $(SOURCES) cat thinkpad.pl thinkpad.glade > $@ chmod a+rx $@ # # False targets. # .PHONY: dummy # # A rule to do nothing # dummy: clean: clean-subdirs -rm -f *.o core $(PROGRAM) # # A rule to make subdirectories # subdir-list-all = $(sort $(patsubst %,_subdir_%,$(SUBDIRS))) all-subdirs: dummy $(subdir-list-all) ifdef SUBDIRS $(subdir-list-all) : dummy $(MAKE) -C $(patsubst _subdir_%,%,$@) endif # # A rule to make clean in subdirectories # subdir-list-clean = $(sort $(patsubst %,_subdir_clean_%,$(SUBDIRS))) clean-subdirs: dummy $(subdir-list-clean) ifdef SUBDIRS $(subdir-list-clean) : dummy $(MAKE) -C $(patsubst _subdir_clean_%,%,$@) clean endif # Distribution targets {{{ dist: distdir GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) ZIP=$(ZIP_ENV) $(ZIP) $(distdir).zip $(distdir) -rm -rf $(distdir) dist-all: distdir GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) ZIP=$(ZIP_ENV) $(ZIP) $(distdir).zip $(distdir) -rm -rf $(distdir) distdir: $(DISTFILES) -rm -rf $(distdir) mkdir $(distdir) @here=`cd $(top_builddir) && pwd`; \ top_distdir=`cd $(distdir) && pwd`; \ distdir=`cd $(distdir) && pwd`; @FILES=`echo "$(DISTFILES)" | awk 'BEGIN{RS=" "}{print}' | sort -u`; \ for file in $$FILES; do \ d=$(srcdir); \ if test -d $$d/$$file; then \ mkdir $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done # }}} # vim600: fdm=marker fdc=3