Makefile 5.26 KB
Newer Older
1
2
# this is <Makefile>
# ----------------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
3
# $Id: Makefile,v 1.15 2006-03-28 17:55:33 tforb Exp $
4
5
6
7
# 
# Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) 
# 
# GSE++ library to read and write GSE waveforms
thomas.forbriger's avatar
thomas.forbriger committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 
# 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
thomas.forbriger's avatar
thomas.forbriger committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#
# Installation instructions
# -------------------------
#
# To install the library use target install
#
# To instell the library together with the doxygen documentation,
# use target all. Note that this requires doxygen to be installed.
#
# Look at gsexx_write_example.cc for a brief example on using the code.
#
# The binary library libgsexx.a will be placed in $(LOCLIBDIR). The prototype
# file gsexx.h will be linked to a copy in $(LOCINCLUDEDIR). If these 
# variables are not set in your environment, they will be set to reasonable
# values below. Please check.
#
# The doxygen documentation will be placed in $(DOXYWWWPATH). In case
# $(LOCLIBDIR) is not set in your environment, this will be set to a default
# value too.
41
42
43
# 
# REVISIONS and CHANGES 
#    16/03/2002   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
44
#    14/11/2002   V1.1   place doxygen docu on WWW
thomas.forbriger's avatar
thomas.forbriger committed
45
46
47
#    25/01/2006   V1.2   - added target gsexx_write_example
#                        - reorganized installation procedure and
#                          installation path definitions
48
49
50
51
52
# 
# ============================================================================
# general part
# ------------
#
thomas.forbriger's avatar
thomas.forbriger committed
53
ifndef LOCLIBDIR
thomas.forbriger's avatar
thomas.forbriger committed
54
55
LOCLIBDIR=lib
DOXYWWWPATH=doxydoc
thomas.forbriger's avatar
thomas.forbriger committed
56
57
58
59
else
DOXYWWWPATH=$(HOME)/public_html/txt/cxx/libgsexx
endif
ifndef LOCINCLUDEDIR
thomas.forbriger's avatar
thomas.forbriger committed
60
LOCINCLUDEDIR=include
thomas.forbriger's avatar
thomas.forbriger committed
61
endif
62
63
64
65
66
67
68

FLAGS=
CXXFLAGS=-fhonor-std -Wall $(FLAGS)
CXXFLAGS=-Wall $(FLAGS)
LDFLAGS=-L$(LOCLIBDIR)
CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS)

thomas.forbriger's avatar
thomas.forbriger committed
69
all: install doxyfull
thomas.forbriger's avatar
thomas.forbriger committed
70
install: install-include libgsexx.a
71
72
73
74
75
76
77
78
79
80

flist: Makefile README $(wildcard *.h *.cc *.cfg)
	echo $^ | tr ' ' '\n' | sort > $@

.PHONY: edit
edit: flist; vim $<

.PHONY: clean
clean: ; 
	-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
81
	-/bin/rm -vf flist *.d *.o gsexx_tests
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

#======================================================================
# pattern rules
# -------------

%.d: %.cc
	$(SHELL) -ec '$(CXX) -M $(CPPFLAGS) $< \
      | sed '\''s,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g'\'' \
        > $@; \
      [ -s $@ ] || rm -f $@'

#======================================================================
# library part
# ------------

thomas.forbriger's avatar
thomas.forbriger committed
97
98
99
LIBSRC=gsexx.cc gsexx_TCHK2.cc gsexx_TWID2.cc gsexx_TSTA2.cc gsexx_TDAT2.cc \
       gsexx_cm6.cc
INCSRC=gsexx.h gsexx_diff.h gsexx_TDAT2.h
100
101
102

-include $(patsubst %.cc,%.d,$(LIBSRC))

thomas.forbriger's avatar
thomas.forbriger committed
103
104
105
106
$(LOCLIBDIR) $(LOCINCLUDEDIR): ; mkdir -pv $@

libgsexx.a: $(patsubst %.cc,%.o,$(LIBSRC)) $(LOCLIBDIR)
	ar rcv $@ $(patsubst %.cc,%.o,$(LIBSRC))
107
	ranlib $@
thomas.forbriger's avatar
thomas.forbriger committed
108
	/bin/mv -fv $@ $(LOCLIBDIR)
109

thomas.forbriger's avatar
thomas.forbriger committed
110
111
install-include: $(LOCINCLUDEDIR)
	ln -sfv $(shell pwd)/gsexx.h $<
112
113
114
115

#======================================================================
# documentation part
# ------------------
thomas.forbriger's avatar
thomas.forbriger committed
116
.PHONY: doxyclean doxyview doxyfullconf 
117

thomas.forbriger's avatar
thomas.forbriger committed
118
doxyclean: ;/bin/rm -rfv doc 
119

thomas.forbriger's avatar
thomas.forbriger committed
120
DOXYSRC=README $(LIBSRC) $(INCSRC) gsexx_tests.cc gsexx_write_example.cc
121

thomas.forbriger's avatar
thomas.forbriger committed
122
123
124
125
126
doc/%: doxyfull.cfg $(DOXYSRC)
	mkdir -vp $(DOXYWWWPATH)
	ln -sfv $(DOXYWWWPATH) doc
	doxygen $<

127
doxyfull: doc/html/index.html
thomas.forbriger's avatar
thomas.forbriger committed
128
doxydoc: doxyfull
129

thomas.forbriger's avatar
thomas.forbriger committed
130
doxyfullview: doxyfull; mozilla file:$(DOXYWWWPATH)/html/index.html &
thomas.forbriger's avatar
thomas.forbriger committed
131
132
133
134
135
136
137
138
139
140
141
142
doxyview: doxyfullview 

#======================================================================
# create package
# --------------
VERSIONCODE=$(shell date +'%Y%m%d')
PACKAGE=libgsexx$(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/libgsexx
thomas.forbriger's avatar
thomas.forbriger committed
143
	cd $(TMPPATH)/..; cvs export -r HEAD -d $(PACKAGE) thof/src/LICENSE.GPL
thomas.forbriger's avatar
thomas.forbriger committed
144
145
	cd $(TMPPATH)/..; cvs export -r HEAD \
        -d $(PACKAGE) thof/src/README.compile
thomas.forbriger's avatar
thomas.forbriger committed
146
147
	/bin/bash -c 'cd $(TMPPATH); \
        unset LOCINCLUDEDIR; unset LOCLIBDIR; \
thomas.forbriger's avatar
thomas.forbriger committed
148
        make all; make clean; /bin/rm -rfv include lib'
thomas.forbriger's avatar
thomas.forbriger committed
149
150
	cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE)
	bzip2 -f $(PUBLICATIONPATH)/$(PACKAGE).tar
151

152
153
154
155
#======================================================================
# test code
# ---------

thomas.forbriger's avatar
thomas.forbriger committed
156
gsexx_write_example gsexx_tests: %: %.cc
thomas.forbriger's avatar
thomas.forbriger committed
157
	$(CXX) -o $@ $< -I$(LOCINCLUDEDIR) -lgsexx -L$(LOCLIBDIR)
thomas.forbriger's avatar
thomas.forbriger committed
158
tests: gsexx_tests; $<; rm -fv $<
159

thomas.forbriger's avatar
thomas.forbriger committed
160
161
162
163
164
165
166
# Target examples requires SFF programs gse2sff and stuplo to be installed
# to plot the data. Use gsexx_write_example separately to check GSE
# data by other means.
examples: gsexx_write_example
	$<; gse2sff example.gse example.sff -o; stuplo example.sff
	rm -fv $< example.gse example.sff

167
# ----- END OF Makefile -----