Makefile 5.71 KB
Newer Older
1
2
# this is <Makefile>
# ----------------------------------------------------------------------------
3
# $Id$
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
# 
thomas.forbriger's avatar
thomas.forbriger committed
9
# ----
thomas.forbriger's avatar
thomas.forbriger committed
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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
23
# ----
thomas.forbriger's avatar
thomas.forbriger committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#
# 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.
thomas.forbriger's avatar
thomas.forbriger committed
43
44
#
# The library code itself depends only on common system libraries.
45
46
47
# 
# REVISIONS and CHANGES 
#    16/03/2002   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
48
#    14/11/2002   V1.1   place doxygen docu on WWW
thomas.forbriger's avatar
thomas.forbriger committed
49
50
51
#    25/01/2006   V1.2   - added target gsexx_write_example
#                        - reorganized installation procedure and
#                          installation path definitions
52
53
#    18/09/2010   V1.3   start migration to SVN scheme
#                        - 
54
55
56
57
58
# 
# ============================================================================
# general part
# ------------
#
59
60
61
62
63
64
65
66
67
68
69
70

all: install doxyfull
install: install-include libgsexx.a

# ============================================================================
# # a variable definition to check variable settings
# # ------------------------------------------------
#
#
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))
#
71
72

FLAGS=
thomas.forbriger's avatar
thomas.forbriger committed
73
FLAGS+=$(MYFLAGS)
74
75
76
77
78
79
80
81
82
83
84
85
86
CXXFLAGS=-Wall $(FLAGS)
LDFLAGS=-L$(LOCLIBDIR)
CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS)

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
87
	-/bin/rm -vf flist *.d *.o gsexx_tests
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

#======================================================================
# 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
103
104
105
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
106
107
108

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

thomas.forbriger's avatar
thomas.forbriger committed
109
110
111
112
$(LOCLIBDIR) $(LOCINCLUDEDIR): ; mkdir -pv $@

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

thomas.forbriger's avatar
thomas.forbriger committed
116
117
install-include: $(LOCINCLUDEDIR)
	ln -sfv $(shell pwd)/gsexx.h $<
118
119
120
121

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

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

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

thomas.forbriger's avatar
thomas.forbriger committed
128
129
130
131
132
doc/%: doxyfull.cfg $(DOXYSRC)
	mkdir -vp $(DOXYWWWPATH)
	ln -sfv $(DOXYWWWPATH) doc
	doxygen $<

133
doxyfull: doc/html/index.html
thomas.forbriger's avatar
thomas.forbriger committed
134
doxydoc: doxyfull
135

thomas.forbriger's avatar
thomas.forbriger committed
136
doxyfullview: doxyfull; $(TF_BROWSER) file:$(DOXYWWWPATH)/html/index.html &
thomas.forbriger's avatar
thomas.forbriger committed
137
138
139
140
141
142
143
144
145
146
147
148
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
149
	cd $(TMPPATH)/..; cvs export -r HEAD -d $(PACKAGE) thof/src/LICENSE.GPL
thomas.forbriger's avatar
thomas.forbriger committed
150
151
	cd $(TMPPATH)/..; cvs export -r HEAD \
        -d $(PACKAGE) thof/src/README.compile
thomas.forbriger's avatar
thomas.forbriger committed
152
153
	cd $(TMPPATH)/..; cvs export -r HEAD \
        -d $(PACKAGE) thof/src/README.1st
thomas.forbriger's avatar
thomas.forbriger committed
154
155
	/bin/bash -c 'cd $(TMPPATH); \
        unset LOCINCLUDEDIR; unset LOCLIBDIR; \
thomas.forbriger's avatar
thomas.forbriger committed
156
        make all; make clean; /bin/rm -rfv include lib'
thomas.forbriger's avatar
thomas.forbriger committed
157
158
	cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE)
	bzip2 -f $(PUBLICATIONPATH)/$(PACKAGE).tar
thomas.forbriger's avatar
thomas.forbriger committed
159
160
	cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE)
	gzip -f -v $(PUBLICATIONPATH)/$(PACKAGE).tar
161

162
163
164
165
#======================================================================
# test code
# ---------

thomas.forbriger's avatar
thomas.forbriger committed
166
gsexx_write_example gsexx_tests: %: %.cc
thomas.forbriger's avatar
thomas.forbriger committed
167
	$(CXX) -o $@ $< -I$(LOCINCLUDEDIR) -lgsexx -L$(LOCLIBDIR)
thomas.forbriger's avatar
thomas.forbriger committed
168
tests: gsexx_tests; $<; rm -fv $<
169

thomas.forbriger's avatar
thomas.forbriger committed
170
171
172
173
174
175
176
# 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

177
# ----- END OF Makefile -----