# this is # ---------------------------------------------------------------------------- # $Id: Makefile,v 1.6 2010-02-24 08:11:30 tforb Exp $ # # Copyright (c) 2006 by Thomas Forbriger (BFO Schiltach) # # all stuff to create libdatwritexx and its package # # ---- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ---- # # REVISIONS and CHANGES # 11/04/2006 V1.0 Thomas Forbriger # # ============================================================================ # MODULES=sff ascii binary HEADERS=$(wildcard *.h $(addsuffix /*.h,$(MODULES))) LIBSRC=$(wildcard *.cc $(addsuffix /*.cc,$(MODULES))) TESTSRC=$(wildcard tests/*.cc) INCINSTALLPATH=$(LOCINCLUDEDIR)/datwritexx LIBINSTALLPATH=$(LOCLIBDIR) # name of headers with comments stripped off STRIPHEADER=$(addsuffix .strip,$(notdir $(HEADERS))) # name of installed (exported) header files INSTHEADER=$(addprefix $(INCINSTALLPATH)/,$(notdir $(HEADERS))) # if defined, empty lines are kept in stripped comment headers # to synchronize line numbers EMPTYPRINT=1 #EMPTYPRINT=0 # define this to be cat in case you do not have remcmmnt available REMCMMNT=remcmmnt #REMCMMNT=cat # # general part # ------------ # FLAGS= CXXFLAGS=-fhonor-std -Wall $(FLAGS) CXXFLAGS=-Wall $(FLAGS) LDFLAGS=-L$(LOCLIBDIR) CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS) all: install doxybrief doxyfull install: install-include libdatwritexx.a DATREADFILES=$(wildcard ../libdatreadxx/*.cc) \ $(wildcard ../libdatreadxx/*.h) \ $(wildcard ../libdatreadxx/*/*.cc) \ $(wildcard ../libdatreadxx/*/*.h) \ ../libdatreadxx/Makefile flist: Makefile $(wildcard *.cfg contrib/*.h) $(HEADERS) $(LIBSRC) \ $(TESTSRC) README $(DATREADFILES) echo $^ | tr ' ' '\n' | sort > $@ .PHONY: edit edit: flist; vim $< .PHONY: clean clean: ; -find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v -find . -name \*.o | xargs --no-run-if-empty /bin/rm -v -find . -name \*.d | xargs --no-run-if-empty /bin/rm -v -/bin/rm -vf flist #====================================================================== # pattern rules # ------------- %.d: %.cc $(SHELL) -ec '$(CXX) -M $(CPPFLAGS) $< \ | sed '\''s,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g'\'' \ > $@; \ [ -s $@ ] || rm -f $@' #====================================================================== # library part # ------------ -include $(patsubst %.cc,%.d,$(LIBSRC) $(TESTSRC)) libdatwritexx.a: $(patsubst %.cc,%.o,$(LIBSRC)) ar rcv $@ $^ ranlib $@ /bin/mv -fv $@ $(LOCLIBDIR) #---------------------------------------------------------------------- # comment stripping %.hd: %.h; echo $(notdir $<.strip): $< > $@ -include $(patsubst %.h,%.hd,$(HEADERS)) # first awk rule assumes that the first non-comment line starts with '#' # and that the first (copyright) comment end with pattern "^ */" %.h.strip: awk 'BEGIN {hot=1;} /^ \*\// { if (hot) { hot=2; print; next;} }\ /^#/ { hot=0; } \ { if (hot==2) { print ""; } else if (hot) { print; } }' $< > $@ $(REMCMMNT) $< | awk 'BEGIN {hot=0;} \ /^ *$$/ { if ((hot) && ($(EMPTYPRINT))) { print; } next; } \ /^#/ { hot=1; } { if (hot) print; }' >> $@ #---------------------------------------------------------------------- $(INCINSTALLPATH)/%.h: %.h.strip mkdir -p $(INCINSTALLPATH) -rm -fv $@ ln -svf $$(pwd)/$< $@ install-include: $(INSTHEADER) touch $@ #====================================================================== # documentation part # ------------------ DOXYWWWPATH=$(WWWBASEDIR)/libdatwritexx .PHONY: doxyclean doxyview doxybriefview doxyfullconf doxybriefconf doxyclean: ;/bin/rm -rfv doc/* docbrief/* doc docbrief DOXYSRC=$(LIBSRC) $(HEADERS) README doc/%: doxyfull.cfg $(DOXYSRC) mkdir -vp $(DOXYWWWPATH) /bin/rm -rfv doc/* doc ln -sfv $(DOXYWWWPATH) doc doxygen $< docbrief/%: doxybrief.cfg $(DOXYSRC); doxygen $< doxybriefconf doxyfullconf: doxy%conf: doxywizard $(patsubst doxy%conf,doxy%.cfg,$@) doxybrief: docbrief/html/index.html doxyfull: doc/html/index.html doxydoc: doxybrief doxyfull doxyfullview: doxyfull; $(TF_BROWSER) file:$(DOXYWWWPATH)/html/index.html & doxybriefview: doxybrief; $(TF_BROWSER) file:/docbrief/html/index.html & doxyview: doxyfullview doxybrief #====================================================================== # test code # --------- writetest: %: tests/%.o libdatwritexx.a $(CXX) $(FLAGS) -o $@ $< -I$(LOCINCLUDEDIR) \ -ldatwritexx -lsffxx -lgsexx -ltsxx -ltfxx -laff -ltime++ \ -L$(LOCLIBDIR) /bin/mv -fv $@ $(LOCBINDIR) #====================================================================== # create package # -------------- LIBRARYNAME=libdatwritexx VERSIONCODE=$(shell date +'%Y%m%d') PACKAGE=$(LIBRARYNAME)$(VERSIONCODE) PUBLICATIONPATH=$(HOME)/public_html/download/software TMPPATH=$(HOME)/tmp/$(PACKAGE) package: /bin/rm -rfv $(TMPPATH); mkdir -pv $(TMPPATH) cd $(TMPPATH)/..; cvs export -r HEAD \ -d $(PACKAGE) thof/src/libs/$(LIBRARYNAME) cd $(TMPPATH)/..; cvs export -r HEAD -d $(PACKAGE) thof/src/LICENSE.GPL cd $(TMPPATH)/..; cvs export -r HEAD \ -d $(PACKAGE) thof/src/README.compile cd $(TMPPATH)/..; cvs export -r HEAD \ -d $(PACKAGE) thof/src/README.1st /bin/bash -c 'cd $(TMPPATH); \ export WWWBASEDIR=doxydoc; \ mkdir -v inctmp; \ make INCINSTALLPATH=inctmp all; make clean; /bin/rm -rfv inctmp' cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE) gzip --force -9 $(PUBLICATIONPATH)/$(PACKAGE).tar cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE) bzip2 -f $(PUBLICATIONPATH)/$(PACKAGE).tar $(MAKE) install # ----- END OF Makefile -----