Makefile 3.29 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
# this is <Makefile>
# ----------------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
3
# $Id$
thomas.forbriger's avatar
thomas.forbriger committed
4
5
6
7
# 
# Copyright (c) 2009 by Thomas Forbriger (BFO Schiltach) 
# 
# fidase: prepare a homogeneous data set from individual shot files
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# ----
# 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
24
25
26
# 
# REVISIONS and CHANGES 
#    08/04/2009   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
27
#    15/11/2010   V1.1   reworked makefile; avoid makedoc.tcl and incdep
thomas.forbriger's avatar
thomas.forbriger committed
28
#    14/01/2011   V1.2   implemented fidasex with libfapidxx interface
thomas.forbriger's avatar
thomas.forbriger committed
29
30
# 
# ============================================================================
31
#
thomas.forbriger's avatar
thomas.forbriger committed
32
 
33
34
35
36
37
38
PROGRAMS=fidase fidasex

.PHONY: all
all: install fidase.doc

.PHONY: install
39
40
41
42
install: $(addprefix $(LOCBINDIR)/,$(PROGRAMS))
$(LOCBINDIR)/%: %
	mkdir -pv $(LOCBINDIR)
	/bin/mv -fv $< $(LOCBINDIR)
thomas.forbriger's avatar
thomas.forbriger committed
43
44
45
46
47

CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))

$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR)
48

thomas.forbriger's avatar
thomas.forbriger committed
49
LINLIB=-lblas -llapack
thomas.forbriger's avatar
thomas.forbriger committed
50
51
PGPLOTLIB=$(TF_LINK_PGPLOT)
CFLAGS= -I${LOCINCLUDEDIR} 
thomas.forbriger's avatar
thomas.forbriger committed
52
FFLAGS += -ff2c -Wall -ffixed-line-length-0 -fno-backslash $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
53
54
55
56
57

#----------------------------------------------------------------------

.PHONY: clean edit

58
flist: Makefile COPYING README $(FIDAOBS:.o=.f) *.inc
thomas.forbriger's avatar
thomas.forbriger committed
59
60
61
62
63
64
65
	echo $< > $@
	echo $(FIDAOBS:.o=.f) | tr ' ' '\n' | sort >> $@
	echo *.inc | tr ' ' '\n' | sort >> $@

edit: flist; vim $<

clean:
66
	-/bin/rm *.o *.bak *.d $(PROGRAMS)
thomas.forbriger's avatar
thomas.forbriger committed
67
68

#----------------------------------------------------------------------
69
70

FIDAOBS=fidase.o fidase_readdata.o fidase_skipdata.o fidase_writedata.o \
thomas.forbriger's avatar
thomas.forbriger committed
71
72
  fidase_readtaper.o fidase_evaltaper.o fidase_enfit.o fidase_resamp.o \
  fidase_destack.o
73

thomas.forbriger's avatar
thomas.forbriger committed
74
#----------------------------------------------------------------------
75

thomas.forbriger's avatar
thomas.forbriger committed
76
%.d: %.f
77
	echo $(patsubst %.f,%.o,$<): $< $(shell cat $< | egrep '^ +include' | cut -f 2 -d \' | sort | uniq) > $@
78
include $(patsubst %.o,%.d,$(FIDAOBS))
79

thomas.forbriger's avatar
thomas.forbriger committed
80
#----------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
81

thomas.forbriger's avatar
thomas.forbriger committed
82
83
84
85
86
87
88
89
fidase.doc: $(patsubst %.o,%.f,$(FIDAOBS))
	/usr/bin/awk 'BEGIN{ hot=0; } \
        /^cS/ { hot=1; \
	    print FILENAME; \
          print "  c\n  c"; \
          next; } \
        /^cE/ { hot=0; } \
        { if (hot==1) { print "  " $$0; } }' $^ > $@
thomas.forbriger's avatar
thomas.forbriger committed
90

thomas.forbriger's avatar
thomas.forbriger committed
91
#----------------------------------------------------------------------
92

thomas.forbriger's avatar
thomas.forbriger committed
93
94
%.o: %.f
	$(FC) -o $@ -c $< $(FFLAGS)
95
96

fidase: $(FIDAOBS)
thomas.forbriger's avatar
thomas.forbriger committed
97
	$(FC) -o $@ $^ \
98
        -ltf -lts -lsffu -ltime_trad -lsff \
99
        $(PGPLOTLIB) $(LINLIB) \
thomas.forbriger's avatar
thomas.forbriger committed
100
        -L$(LOCLIBDIR) 
101

thomas.forbriger's avatar
thomas.forbriger committed
102
103
104
105
fidasex: $(FIDAOBS)
	$(FC) -o $@ $^ \
        -ltf -lts -lsffu -ltime_trad  \
	  -lfapidxx -ldatrwxx -lsffxx -lgsexx -ltime++ -laff \
106
        $(PGPLOTLIB) $(LINLIB) -lstdc++\
thomas.forbriger's avatar
thomas.forbriger committed
107
108
        -L$(LOCLIBDIR) 

thomas.forbriger's avatar
thomas.forbriger committed
109
# ----- END OF Makefile -----