File: Makefile

package info (click to toggle)
sprng 2.0a-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,076 kB
  • ctags: 2,031
  • sloc: ansic: 30,361; fortran: 1,618; makefile: 566; cpp: 58; sh: 5
file content (121 lines) | stat: -rw-r--r-- 4,334 bytes parent folder | download | duplicates (9)
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
############################################################################
# This is a make file compiles the test executables
#
# We have set variables giving information on the archiver, the C compiler 
# and the FORTRAN compiler for certain machines in files make.xxx, where xxx 
# is the machine name, set in ../make.CHOICES. 
#
# Typing the command below    => results in the following being created
#      make                        => All the sequential and parallel tests.
#      make xxx                    => Test 'xxx.rng' for each generator 'rng'.
#
# Object files created during the compilation process can be deleted finally
# by typing
#       make clean
#
# Object files and the test executables created can be deleted finally
# by typing
#       make realclean
#
# Set 'LIBDIR' to the directory where the SPRNG libraries are. 
# Set 'INCDIR' to the directory where the SPRNG include files are. 
# We have already set them to the correct locations, unless whoever installed
# the libraries changed them.
############################################################################
SHELL = /bin/sh
include ../make.CHOICES
LIBDIR = ../$(LIB_REL_DIR)
INCDIR = ../include
SRCDIR = ../SRC
include $(SRCDIR)/make.$(PLAT)
TESTLIB = sprngtest
#GMPLIB = -lgmp #uncomment for pmlcg

#############################################################################
# Random number libraries

# lcg, lfg, or lcg64 for 48 bit, Fibonacci, and 64 bit LCG cmrg for
# the combined multiple recursive genrator, pmlcg for the prime
# modulus LCG, and mlfg for the multiplicative lagged Fibonacci
# generator respectively.

LIBLIST = sprng

# To create a new test 'xxx', place the source code in file 'xxx.c`
# Then append 'xxx' to TESTLIST below. This assumes that 'xxx.c'
# depends on 'tests.h' and 'util.h' alone. If there are more dependencies,
# then explicitly write the commands for that. 'xxx.yyy' files are created
# for each random number library 'libyyy.a' in LIBLIST.

TESTLIST = maxt collisions equidist serial gap perm runs coupon poker  sum random_walk wolff metropolis
#
# ____________________________________________________________________
# The user should normally not need to change anything below this line
# _____________________________________________________________________
##############################################################################

INCLUDEDIR = -I$(INCDIR)

all : $(LIBDIR)/lib$(TESTLIB).a $(TESTLIST) 

$(LIBDIR)/lib$(TESTLIB).a: init_tests.o chisquare.o stirling.o communicate.o 
	$(AR) $(ARFLAGS) $(LIBDIR)/lib$(TESTLIB).a  init_tests.o chisquare.o stirling.o communicate.o 
	$(RANLIB) $(LIBDIR)/lib$(TESTLIB).a
	$(LD) -r -o $(LIBDIR)/lib$(TESTLIB).so init_tests.o chisquare.o stirling.o communicate.o 

init_tests.o : init_tests.c
	$(CC) -c $(CFLAGS) $(INCLUDEDIR) $(DEF) init_tests.c

util.o : util.c
	$(CC) -c $(CFLAGS) $(INCLUDEDIR) $(DEF) util.c

stirling.o : stirling.c util.h
	$(CC) -c $(CFLAGS) $(INCLUDEDIR) $(DEF) stirling.c

chisquare.o : chisquare.c util.h
	$(CC) -c $(CFLAGS) $(INCLUDEDIR) $(DEF) chisquare.c

communicate.o : communicate.c
	$(CC) -c  $(CFLAGS)  $(INCLUDEDIR) $(DEF) communicate.c

$(BASE).o : $(BASE).c tests.h util.h
	$(CC) -c $(CFLAGS) $(INCLUDEDIR) $(DEF) $(BASE).c

$(TESTLIST) : 
	@for l in $(LIBLIST) ; do \
	  $(MAKE) LIB=$$l BASE=$@ DEF=$(DEF) PLAT=$(PLAT) \
                  $@.$$l ; \
        done

$(BASE).$(LIB) : $(BASE).o $(LIBDIR)/lib$(TESTLIB).a $(LIBDIR)/lib$(LIB).a
	$(CLD) $(CLDFLAGS) -o $@ $(BASE).o -L$(LIBDIR) -l$(TESTLIB) -l$(LIB) $(GMPLIB) -lm $(MPIDIR) $(MPILIB)

#######################################################################
#  FFT test for parallel RNGs
#

fft : 
	@for l in $(LIBLIST) ; do \
	  $(MAKE) LIB=$$l DEF=$(DEF) PLAT=$(PLAT) \
                  $@.$$l ; \
        done

fft.o : fft.c $(INCDIR)/sprng.h
	$(CC) -c $(CFLAGS) $(INCLUDEDIR) $(DEF) $(CHK) -I$(INCDIR) fft.c 

fft.$(LIB) : fft.o $(LIBDIR)/lib$(TESTLIB).a $(LIBDIR)/lib$(LIB).a
	$(CLD) $(CLDFLAGS) $(INCLUDEDIR) $(DEF) $(CHK) -I$(INCDIR) -o $@ fft.o -L$(LIBDIR) -l$(LIB) -lcomplib.sgimath -lftn $(GMPLIB)


#########################################################################

clean :
	@rm -f *.o

realclean :
	@rm -f *.o $(LIBDIR)/lib$(TESTLIB).a
	@for l in $(LIBLIST) ; do \
	  rm -f *.$$l ; \
        done
	rm -f *~ core a.out
.SUFFIXES :