-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (48 loc) · 1.66 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
# Change this to install into a different directory
LIB_INSTALL_DIR = $${HOME}/.local/lib
ifeq ($(OS),Windows_NT)
#on windows
LIB_INSTALL_NAME = 'diffprivhs.*'
else
#on linux
LIB_INSTALL_NAME = 'libdiffprivhs.*'
endif
all: capp
usingcabal: ffisrc/Wrapper.hs wrapper.cabal.old
rm -f wrapper.cabal
cp wrapper.cabal.old wrapper.cabal
cabal configure && cabal build
find dist-newstyle/ -name 'libwrapper.*' -exec cp {} ./capp/ \;
wrapperlib: ffisrc/Wrapper.hs package.yaml stack.yaml
rm -f DiffPrivacyInferenceHs.cabal
stack build
# stack build --ghc-options -j
find .stack-work/ -name 'libdiffprivhs.*' -exec cp {} ./capp/ \;
capp: wrapperlib
cd capp && make
run: capp
cd capp && make run
# --------------------------------------
# simply installing the shared library by copying it
install: wrapperlib-install
wrapperlib-install: ffisrc/Wrapper.hs package.yaml stack.yaml
rm -f DiffPrivacyInferenceHs.cabal
stack build
# stack build --ghc-options -j
mkdir -p ${LIB_INSTALL_DIR}
/usr/bin/find .stack-work/ -name ${LIB_INSTALL_NAME} -exec cp {} ${LIB_INSTALL_DIR} \;
# ------------------------------------
# --------------------------------------
# install with profiling
install-profile: wrapperlib-install
wrapperlib-install-profile: ffisrc/Wrapper.hs package.yaml stack.yaml
rm -f DiffPrivacyInferenceHs.cabal
stack build --profile --ghc-options -j
mkdir -p ${LIB_INSTALL_DIR}
/usr/bin/find .stack-work/ -name ${LIB_INSTALL_NAME} -exec cp {} ${LIB_INSTALL_DIR} \;
# ------------------------------------
clean:
rm -f wrapper.cabal
rm -fr dist-newstyle
stack clean && cd capp && make clean
.PHONY: all usingcabal wrapperlib capp run clean install