forked from dmilios/stochastic
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
89 lines (69 loc) · 2.32 KB
/
Makefile
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
# `Makefile'
#
# Build stochastic library, run tests, etc.
#
# Targets:
#
###############################################################################
###############################################################################
# This opening `if' relocates us into a platform-specific build directory and
# re-runs make there. The real build stuff is below the `else'...
ifndef source_dir
# Not yet jumped to build directory, so work out where it is and jump there
# now.
this_makefile:=$(lastword $(MAKEFILE_LIST))
build_root?=$(CURDIR)/build
platform?=$(shell uname -om | tr 'A-Z \-/\\.()' a-z\-_)
build_dir:=$(build_root)/$(platform)
.SUFFIXES:
MAKETARGET=$(MAKE) --no-print-directory -C $@ -f $(CURDIR)/$(this_makefile) \
build_dir=$(build_dir) platform=$(platform) source_dir=$(CURDIR) \
this_makefile:=$(this_makefile) $(filter-out clean,$(MAKECMDGOALS))
.PHONY: $(build_dir)
$(build_dir):
+@[ -d $@ ] || mkdir -p $@
+@$(MAKETARGET)
$(this_makefile): ;
%:: $(build_dir) ;
.PHONY: clean
clean:
$(RM) -fr $(build_dir)
if [ -d $(build_root) ] ; \
then \
rmdir --ignore-fail-on-non-empty $(build_root); \
fi
else
# End of build directory stuff.
###############################################################################
CC:=g++
CXXFLAGS:=-g -Wall -fPIC
LDFLAGS:=-g -L.
slib:=libstochastic.a
dlib:=libstochastic.so
lib_srcs:=ApproximationAlgorithm.cpp Cauchy.cpp ChiSquare.cpp \
DeltaDistribution.cpp Distribution.cpp EmpiricalDistribution.cpp \
Exponential.cpp FileParser.cpp Gaussian.cpp GraphRV.cpp \
InverseRV_Distribution.cpp MaxOfDistributions.cpp \
MinOfDistributions.cpp MixtureModel.cpp MonteCarloAlgorithm.cpp \
NodeRV.cpp PG_EM.cpp PiecewiseGaussian.cpp PiecewiseUniform.cpp \
ProbabilisticDiscretization.cpp PU_DivideAndConquer.cpp \
RandomVariable.cpp SumOfUniforms.cpp Uniform.cpp
lib_objs:=$(lib_srcs:%.cpp=%.o)
test:=main
test_srcs:=main.cpp Experiments.cpp Gnuplot.cpp
test_objs:=$(test_srcs:%.cpp=%.o)
test_libs:=$(slib)
vpath %.cpp $(addprefix $(source_dir)/,src src/algorithms src/distributions \
src/graph src/intermediateResults src/utilities test_src)
.PHONY: all
all: $(dlib)
$(source_dir)/perl/test.pl
.PHONY: test
test: $(test)
$<
$(slib): $(lib_objs)
ar cvr $@ $?
$(dlib): $(lib_objs)
$(CC) -shared -Wl,-soname,$@ -o $@ $^
$(test): $(test_objs) $(test_libs)
endif