Makefile 3.08 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) 2002 by Thomas Forbriger (IMG Frankfurt) 
# 
# sousou - sound source
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
27
28
# 
# REVISIONS and CHANGES 
#    10/05/2002   V1.0   Thomas Forbriger
# 
# ============================================================================
29
#
30
31
 
PROGRAMS=sousou sousoux
thomas.forbriger's avatar
thomas.forbriger committed
32

33
34
35
36
37
38
39
.PHONY: all
all: install doc

.PHONY: doc
doc: sousou.doc

.PHONY: install
40
41
42
43
install: $(addprefix $(LOCBINDIR)/,$(PROGRAMS))
$(LOCBINDIR)/%: %
	mkdir -pv $(LOCBINDIR)
	/bin/mv -fv $< $(LOCBINDIR)
44
45

#----------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
46
47
48
49
50
51
52

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

$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR)
$(call CHECKVARS,TF_BROWSER TF_WWWBASEDIR)

53
FLAGS += $(MYFLAGS) -fPIC
thomas.forbriger's avatar
thomas.forbriger committed
54
FFLAGS += -ff2c -Wall -ffixed-line-length-0 -fno-backslash $(FLAGS)
55
56
57
58
59
CFLAGS += $(FLAGS)
CXXFLAGS+=-Wall $(FLAGS)
LDFLAGS+=$(addprefix -L,$(LOCLIBDIR) $(subst :, ,$(SERVERLIBDIR)))
CPPFLAGS+=$(addprefix -I,$(LOCINCLUDEDIR) $(subst :, ,$(SERVERINCLUDEDIR))) \
  $(FLAGS)
thomas.forbriger's avatar
thomas.forbriger committed
60
61

#----------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
62

63
flist: Makefile COPYING README $(wildcard *.f *.inc)
thomas.forbriger's avatar
thomas.forbriger committed
64
65
66
67
68
69
70
71
	echo $^ | tr ' ' '\n' | sort > $@

.PHONY: edit
edit: flist; vim $<

.PHONY: clean
clean: ; 
	-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
72
	-/bin/rm -vf flist *.o *.d *.doc $(PROGRAMS)
73

thomas.forbriger's avatar
thomas.forbriger committed
74
#----------------------------------------------------------------------
75
76
77
78

OBS=sousou.o sousou_readdata.o sousou_skipdata.o sousou_checks.o \
   sousou_prepare.o sousou_writedata.o sousou_analysis.o sousou_writeslow.o

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

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

sousou: $(OBS)
93
94
95
	$(FC) -o $@ $(OBS) \
        -ltf -lts -lsffu -lsff -ltime \
        $(TF_LINK_PGPLOT) -llapack -lblas \
thomas.forbriger's avatar
thomas.forbriger committed
96
        -L$(LOCLIBDIR) 
97

98
99
100
101
102
sousoux: $(OBS)
	$(FC) -o $@ $(OBS) \
        -ltf -lts -lsffu -lfapidxx -ldatrwxx -lsffxx -lgsexx -laff -ltime++ \
        $(TF_LINK_PGPLOT) -llapack -lblas \
        -L$(LOCLIBDIR) 
thomas.forbriger's avatar
thomas.forbriger committed
103
104

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