File: Makefile

package info (click to toggle)
xcrysden 1.6.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,040 kB
  • sloc: ansic: 36,624; tcl: 33,824; fortran: 6,744; sh: 2,219; makefile: 759; f90: 429; awk: 382; pascal: 30
file content (336 lines) | stat: -rw-r--r-- 9,593 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
#------------------------------------------------------------------------
#
# XCRYSDEN Top Makefile
#
#------------------------------------------------------------------------

SHELL     = /bin/sh
TOPDIR    = $(CURDIR)
TCL_INDEX = $(TOPDIR)/util/tcl_index

include make.include

what:
	@clear;	$(SHELL) make-usage 


# some varibales ...

all: tcl tk mesa togl fftw xcrysden
#  meschach 
xcrysden: usage bindir src-C src-F src-Tcl

usage: $(TOPDIR)/docs/xcrysden.1
	man $(TOPDIR)/docs/xcrysden.1 | awk 'BEGIN {lprint=0; print "## do not edit changes will be lost (file automatically generated)\n"; } /SYNOPSIS/ { lprint=1; } /SEE ALSO/ { lprint=0; } /a*/ { if (lprint) print; }' > usage

check-make-sys:
	@if test ! -f Make.sys ; then \
	echo ""; \
	echo "   First copy an appropriate system/Make.* file to ./Make.sys "; \
	echo "   and edit it to suit your needs."; \
	echo ""; exit 1; fi

help:
	@. make-usage


bindir:
	if test ! -d bin ; then mkdir bin; fi

tcl: check-make-sys
	if test -d external/src ; then \
		cd external/src; $(MAKE)  "TOPDIR=$(TOPDIR)" tcl; \
	fi

tk: check-make-sys
	if test -d external/src ; then \
		cd external/src; $(MAKE)  "TOPDIR=$(TOPDIR)" tk; \
	fi

togl: check-make-sys
	if test -d external/src ; then \
		cd external/src; $(MAKE)  "TOPDIR=$(TOPDIR)" togl; \
	fi

mesa: check-make-sys
	if test -d external/src ; then \
		cd external/src; $(MAKE)  "TOPDIR=$(TOPDIR)" mesa; \
	fi

meschach: check-make-sys
	if test -d external/src ; then \
		cd external/src; $(MAKE)  "TOPDIR=$(TOPDIR)" meschach; \
	fi

fftw: check-make-sys
	if test -d external/src ; then \
		cd external/src; $(MAKE)  "TOPDIR=$(TOPDIR)" fftw; \
	fi

bwidget: check-make-sys
	if test -d external/src ; then \
		cd external/src; $(MAKE)  "TOPDIR=$(TOPDIR)" bwidget; \
	fi

src-C: check-make-sys
	@echo
	@echo "#------------------------------#"
	@echo "#                              #"
	@echo "#   Compiling XCRYSDEN C-code  #"
	@echo "#                              #"
	@echo "#------------------------------#"
	@echo
	cd C; $(MAKE) "TOPDIR=$(TOPDIR)" compile


src-F: check-make-sys
	@echo
	@echo "#------------------------------#"
	@echo "#                              #"
	@echo "#   Compiling XCRYSDEN F-code  #"
	@echo "#                              #"
	@echo "#------------------------------#"
	@echo
	cd F/SRC_nn; $(MAKE)  "TOPDIR=$(TOPDIR)"
	cd F/SRC_spaghetti; $(MAKE)  "TOPDIR=$(TOPDIR)"
	cd F; $(MAKE)  "TOPDIR=$(TOPDIR)"

src-Tcl:
	@echo
	@echo "#------------------------------#"
	@echo "#                              #"
	@echo "#  Managing XCRYSDEN Tcl-code  #"
	@echo "#                              #"
	@echo "#------------------------------#"
	@echo
	cd Tcl; $(MAKE)
	cd Tcl/fs; $(MAKE)

tests:
	if test -x bin/xcrys ; then cd tests; ./make_all_tests.sh; fi

# ------------------------------------------------------------------------
#
# clean-targets
#
# ------------------------------------------------------------------------

clean: clean-C clean-F clean-Tcl wrappers_clean	
	cd examples; $(MAKE) clean

veryclean: clean clean-bin clean-docs clean-external 

distclean: veryclean clean-bck
	if test -f usage;    then rm -f usage; fi
	if test -d external; then cd external; $(MAKE) distclean; fi

clean-bck:
	-rm -f *~
	-rm -f */*~
	-rm -f */*/*~
	-rm -f */*/*/*~

clean-C: check-make-sys
	cd C; $(MAKE) "TOPDIR=$(TOPDIR)" clean

clean-F: check-make-sys
	-cd F/SRC_nn; $(MAKE) "TOPDIR=$(TOPDIR)" clean
	-cd F/SRC_spaghetti; $(MAKE) "TOPDIR=$(TOPDIR)" clean
	-cd F; $(MAKE) "TOPDIR=$(TOPDIR)" clean

clean-Tcl:
	cd Tcl/fs; $(MAKE) clean
	cd Tcl; $(MAKE) clean

clean-bin:
	if test -d bin/; then \
		rm -f bin/*; \
	fi

clean-docs:
	if test -d docs/; then \
		cd docs; $(MAKE) "TOPDIR=$(TOPDIR)" veryclean; \
	fi

clean-external:
	if test -d external/src ; then \
	   cd external/src ; $(MAKE) "TOPDIR=$(TOPDIR)" clean; \
	fi

wrappers_clean:
	for file in $(addsuffix .wrapper,$(PROGS)); do \
		if test -f $$file; then rm -f $$file; fi; \
	done 

# ========================================================================
#
# here are targets for making various distributions
#
# ========================================================================

PROGS = xcrysden pwi2xsf pwo2xsf ptable unitconv

README_FILES = \
	AUTHORS \
	COPYING \
	COPYRIGHT \
	ChangeLog \
	NEWS \
	README README.cygwin \
	THANKS \
	otherLICENSES/ 

IRON_ITEMS = usage version xcrysden
IRON_DIRS = \
	Awk/ \
	Tcl/*.tcl Tcl/tclIndex Tcl/fs/*.tcl Tcl/fs/tclIndex \
	Tcl/Xcrysden_resources Tcl/custom-definitions \
	contrib/ \
	examples/ \
	images/ \
	scripts/ \
	tests/ \
	util/ 

MAN_PAGES  = $(addsuffix .1,$(PROGS))
MAN_FILES  = $(addprefix docs/,$(MAN_PAGES))
BAT_FILES  = xcrysden.bat 
IRON_FILES = $(IRON_ITEMS) $(IRON_DIRS) $(MAN_FILES)

SRC_ONLY_FILES = \
	Makefile make-usage make.include \
	C/*.c C/*.h C/Makefile C/make-objects C/*.cygwin \
	F/*.f F/*.f90 F/*.inc F/Makefile \
	F/*/*.f F/*/*.inc F/*/Makefile \
	Tcl/Makefile Tcl/fs/Makefile \
	docs/Makefile \
	sys_utils/*.sh \
	system/ \

EXTERNAL_SRC_FILES    = external/Makefile external/src/Makefile
EXTERNAL_LIB_BWIDGET  = external/lib/bwidget-$(BWIDGET_VER)
EXTERNAL_LIB_TCLTK    = external/lib/tcl$(TCL_VER2) external/lib/tk$(TCL_VER2) external/lib/Togl$(TOGL_VER)
EXTERNAL_LIB          = external/lib

EXTERNAL_SHAREDLIB_FILES = $(wildcard \
	external/lib/libtcl$(TCL_VER2).so* external/lib/libtcl$(TCL_VER2).dylib \
	external/lib/libtk$(TCL_VER2).so* external/lib/libtk$(TCL_VER2).dylib \
	external/lib/libTogl$(TOGL_VER).so* external/lib/libTogl$(TOGL_VER).dylib \
	external/lib/libGL.so* external/lib/libGL.*.dylib* \
	external/lib/libGLU.so* external/lib/libGLU.*.dylib* \
	external/lib/libmeschach.so* external/lib/libmeschach*.dylib* \
	external/lib/libfftw3.so* external/lib/libfftw3*.dylib* \
	external/lib/libquadmath.so* external/lib/libquadmath.dylib*)

EXTERNAL_GFORTRAN_LIB =
#EXTERNAL_GFORTRAN_LIB = external/lib/libgfortran.so.$(GFORTRAN_MINOR_VERSION)

BIN_FILES = bin/

# ------------------------------------------------------------------------
#
# Target for installing system wide: default localtion is /usr/local
# To install to different location run as: prefix=XXXXX make iunstall
#
# ------------------------------------------------------------------------

prefix   ?= $(DESTDIR)/usr
version  := $(shell cat version)
xcrysden  = xcrysden

install: xcrysden
	@echo
	@echo "#-----"
	@echo "#                          "
	@echo "#   Installing XCRYSDEN to: $(prefix)"
	@echo "#                          "
	@echo "#-----"
	@echo	
	install -m755 -d $(prefix)/share/$(xcrysden)
	cp -a $(IRON_ITEMS) $(prefix)/share/$(xcrysden)
	\
	for subdir in Awk $(EXTERNAL_LIB_BWIDGET) images scripts Tcl util; do \
		if test -d $$subdir; then \
			install -m755 -d $(prefix)/share/$(xcrysden)/$$subdir; \
			cp -a   $$subdir/* $(prefix)/share/$(xcrysden)/$$subdir; \
		fi; \
	done
	\
	if test -d examples; then \
		install -m755 -d $(prefix)/share/doc/$(xcrysden)/examples; \
		cp -a   examples/* $(prefix)/share/doc/$(xcrysden)/examples; \
		ln -sf $(prefix)/share/doc/$(xcrysden)/examples $(prefix)/share/$(xcrysden)/examples; \
	fi; \
	\
	install -m755 -d $(prefix)/share/man/man1
	install -m644 $(MAN_FILES) $(prefix)/share/man/man1/
	gzip -f $(addprefix $(prefix)/share/man/man1/,$(MAN_PAGES))
	\
	install -m755 -d $(prefix)/lib/$(xcrysden)
	install -m755 bin/*  $(prefix)/lib/$(xcrysden)/
	\
	prefix=$(prefix) xcrysden=$(xcrysden) sh sys_utils/wrappers.sh
	if test ! -d $(prefix)/bin; then install -m755 -d $(prefix)/bin; fi
	for prog in $(PROGS); do \
		install -m755 $$prog.wrapper   $(prefix)/bin/$$prog; \
	done



#------------------------------------------------------------------------
#
# SOURCE-distributions
#
#------------------------------------------------------------------------

srcdist:      clean-bck src-Tcl usage _src-dist    

#------------------------------------------------------------------------
#
# BINARY (i.e. precompiled) distributions 
#
#------------------------------------------------------------------------

bindist: bindist-shared; # the default bindist is shared

bindist-static:      clean-bck xcrysden _bin-dist-static
bindist-shared:      clean-bck xcrysden _bin-dist-fully-shared
bindist-semishared:  clean-bck xcrysden _bin-dist-semishared


#
# sorce distribution 
#
_src-dist: 
	tar -cvf xcrysden.tar $(README_FILES) $(IRON_FILES) $(BAT_FILES) $(SRC_ONLY_FILES) $(EXTERNAL_SRC_FILES)
	sys_utils/xcRepackage.sh $(TOPDIR) xcrysden.tar


#
# statically linked binary distribution (with external/lib/tcl/ and external/lib/tk/)
#
_bin-dist-static: 
	tar -cvf xcrysden.tar $(README_FILES) $(IRON_FILES) $(EXTERNAL_LIB_BWIDGET) $(EXTERNAL_LIB_TCLTK) $(BIN_FILES)
	sys_utils/xcRepackage.sh $(TOPDIR) xcrysden.tar bin-static


# shared linked distribution without shared libs
_bin-dist-fully-shared: 
	if test -f $(EXTERNAL_GFORTRAN_LIB); then \
		tar -cvf xcrysden.tar $(README_FILES) $(IRON_FILES) $(EXTERNAL_LIB_BWIDGET) $(BIN_FILES) $(EXTERNAL_GFORTRAN_LIB); \
	else \
		tar -cvf xcrysden.tar $(README_FILES) $(IRON_FILES) $(EXTERNAL_LIB_BWIDGET) $(BIN_FILES); fi
	sys_utils/xcRepackage.sh $(TOPDIR) xcrysden.tar bin-shared


# semi-shared linked distribution with shared libs in external/lib
_bin-dist-semishared:
	-tar -cvf xcrysden.tar \
		$(README_FILES) $(IRON_FILES) $(EXTERNAL_LIB_BWIDGET) $(EXTERNAL_LIB_TCLTK) $(EXTERNAL_SHAREDLIB_FILES) $(BIN_FILES); \
		status=$$?; \
		if test $$status -gt 0; then \
			tar -cvf xcrysden.tar \
			$(README_FILES) $(IRON_FILES) $(EXTERNAL_LIB) $(BIN_FILES); \
		fi
	sys_utils/xcRepackage.sh $(TOPDIR) xcrysden.tar bin-semishared