Makefile 4.4 KB
Newer Older
1
2
# this is <Makefile>
# ----------------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
3
# $Id: Makefile,v 1.12 2006-01-25 10:36:53 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
22
23
24
25
26
#
# 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.
27
28
29
# 
# REVISIONS and CHANGES 
#    16/03/2002   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
30
#    14/11/2002   V1.1   place doxygen docu on WWW
thomas.forbriger's avatar
thomas.forbriger committed
31
32
33
#    25/01/2006   V1.2   - added target gsexx_write_example
#                        - reorganized installation procedure and
#                          installation path definitions
34
35
36
37
38
# 
# ============================================================================
# general part
# ------------
#
thomas.forbriger's avatar
thomas.forbriger committed
39
ifndef LOCLIBDIR
thomas.forbriger's avatar
thomas.forbriger committed
40
41
LOCLIBDIR=lib
DOXYWWWPATH=doxydoc
thomas.forbriger's avatar
thomas.forbriger committed
42
43
44
45
else
DOXYWWWPATH=$(HOME)/public_html/txt/cxx/libgsexx
endif
ifndef LOCINCLUDEDIR
thomas.forbriger's avatar
thomas.forbriger committed
46
LOCINCLUDEDIR=include
thomas.forbriger's avatar
thomas.forbriger committed
47
endif
48
49
50
51
52
53
54

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

thomas.forbriger's avatar
thomas.forbriger committed
55
all: install doxyfull
thomas.forbriger's avatar
thomas.forbriger committed
56
install: install-include libgsexx.a
57
58
59
60
61
62
63
64
65
66

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
67
	-/bin/rm -vf flist *.d *.o gsexx_tests
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

#======================================================================
# 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
83
84
85
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
86
87
88

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

thomas.forbriger's avatar
thomas.forbriger committed
89
90
91
92
$(LOCLIBDIR) $(LOCINCLUDEDIR): ; mkdir -pv $@

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

thomas.forbriger's avatar
thomas.forbriger committed
96
97
install-include: $(LOCINCLUDEDIR)
	ln -sfv $(shell pwd)/gsexx.h $<
98
99
100
101

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

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

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

thomas.forbriger's avatar
thomas.forbriger committed
108
109
110
111
112
doc/%: doxyfull.cfg $(DOXYSRC)
	mkdir -vp $(DOXYWWWPATH)
	ln -sfv $(DOXYWWWPATH) doc
	doxygen $<

113
doxyfull: doc/html/index.html
thomas.forbriger's avatar
thomas.forbriger committed
114
doxydoc: doxyfull
115

thomas.forbriger's avatar
thomas.forbriger committed
116
doxyfullview: doxyfull; mozilla file:$(DOXYWWWPATH)/html/index.html &
thomas.forbriger's avatar
thomas.forbriger committed
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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
	/bin/bash -c 'cd $(TMPPATH); \
        unset LOCINCLUDEDIR; unset LOCLIBDIR; \
thomas.forbriger's avatar
thomas.forbriger committed
131
        make all; /bin/rm -rfv include lib'
thomas.forbriger's avatar
thomas.forbriger committed
132
133
	cd $(TMPPATH)/..; tar cvf $(PUBLICATIONPATH)/$(PACKAGE).tar $(PACKAGE)
	bzip2 -f $(PUBLICATIONPATH)/$(PACKAGE).tar
134

135
136
137
138
#======================================================================
# test code
# ---------

thomas.forbriger's avatar
thomas.forbriger committed
139
gsexx_write_example gsexx_tests: %: %.cc
thomas.forbriger's avatar
thomas.forbriger committed
140
	$(CXX) -o $@ $< -I$(LOCINCLUDEDIR) -lgsexx -L$(LOCLIBDIR)
thomas.forbriger's avatar
thomas.forbriger committed
141
tests: gsexx_tests; $<; rm -fv $<
142

thomas.forbriger's avatar
thomas.forbriger committed
143
144
145
146
147
148
149
# 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

150
# ----- END OF Makefile -----