-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
139 lines (101 loc) · 4.09 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
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
.PHONY: all plans build install configure install_prep
PLANS:=$(shell find plans -name "*.plan")
PNMLS=$(PLANS:.plan=.pnml)
# set you toolchain according to your qibuild toolchains, default is cross-compilatio for pepper,
# usually, we should have only "pepper" and "linux64", as described at https://sites.google.com/a/dis.uniroma1.it/peppino/software-setup
TOOLCHAIN?=linux64
AUX_DIRS=scripts actions plans maps setup.bash
# worktree, usually one level up
WORKTREE?=$(shell readlink -f ..)
# path to the pnp_translator
PNPTRANS=$(WORKTREE)/PetriNetPlans/PNPgen/bin/pnpgen_translator
# install tree for the full installation
INSTALL_TREE?=$(shell readlink -f ../..)
# find git repos:
GIT_REPOS:=$(shell find ${WORKTREE} -maxdepth 2 -name .git | sed 's/.git//' | xargs -n 1 -r readlink -f)
GIT_BRANCH=$(TOOLCHAIN)
QIBUILDS:=$(shell find $(WORKTREE) -name qiproject.xml)
QIBUILDS_DIRS=$(QIBUILDS:/qiproject.xml=)
QIBUILDS_BUILD_DIRS=$(QIBUILDS_DIRS:=/build-$(TOOLCHAIN))
QI_CONF_OPTS:=-w $(WORKTREE) -c $(TOOLCHAIN) --release
QI_MAKE_OPTS:=-c $(TOOLCHAIN)
all: build
update:
for d in ${GIT_REPOS}; do \
(cd $$d; git pull); \
done
clean:
#cookies/configure-$(TOOLCHAIN)
rm -rf $(WORKTREE)/.qi
rm -rf $(PNMLS)
rm -rf $(QIBUILDS_BUILD_DIRS)
# for qb in $(QIBUILDS); do \
# d=`dirname $$qb`; \
# (cd $$d; pwd; qibuild clean -z -s -f) \
# done
rm -rf cookies
rm -f $(WORKTREE)/PetriNetPlans/PNPgen/bin/pnpgen_translator
rm -rf $(WORKTREE)/PetriNetPlans/PNP/build
rm -rf $(WORKTREE)/PetriNetPlans/PNPgen/build
BINS:=$(shell find $(QIBUILDS_BUILD_DIRS) -type f | xargs -r file | grep -G "LSB *executable" | cut -f1 -d: | grep -v CMakeFiles)
LIBS:=$(shell find $(QIBUILDS_BUILD_DIRS) -type f -a -name "*.so" | xargs -r file | grep -G "LSB *shared object" | cut -f1 -d: | grep -v CMakeFiles)
PYTHON_SCRIPTS:=$(shell find $(QIBUILDS_DIRS) -type f -executable -name "*.py")
bins: build $(BINS) $(LIBS)
@echo $(QIBUILDS_BUILD_DIRS)
@echo $(BINS)
@echo $(LIBS)
python_scripts: $(PYTHON_SCRIPTS)
@echo $(PYTHON_SCRIPTS)
install_python_scripts: $(PYTHON_SCRIPTS)
install -d $(INSTALL_TREE)/bin
install $(PYTHON_SCRIPTS) $(INSTALL_TREE)/bin
pnp_trans: $(WORKTREE)/PetriNetPlans/PNPgen/bin/pnpgen_translator
$(PNPTRANS):
-(cd $(WORKTREE)/PetriNetPlans/PNP/include && ln -s /usr/include/FlexLexer.h .)
(cd $(WORKTREE)/PetriNetPlans/PNP && mkdir -p build && \
cd build && cmake .. && make)
(cd $(WORKTREE)/PetriNetPlans/PNPgen && mkdir -p build && \
cd build && cmake .. && make)
install_bins: bins
install -d $(INSTALL_TREE)/bin $(INSTALL_TREE)/lib
install $(BINS) $(INSTALL_TREE)/bin
install -m 664 $(LIBS) $(INSTALL_TREE)/lib
plans: $(PNMLS)
@echo $^
plans/%.pnml: plans/%.plan $(PNPTRANS)
cd plans/; $(PNPTRANS) inline $*.plan > $*-trans.log
# $(INSTALL_TREE)/.git:
# mkdir -p $(INSTALL_TREE)
# (git clone --depth 1 --recursive -b $(GIT_BRANCH) \
# --single-branch https://github.com/lcas/spqrel_launch.git $(INSTALL_TREE) || \
# git init $(INSTALL_TREE))
# install_prep: $(INSTALL_TREE)/.git
# install_pull: #install_prep
# (cd $(INSTALL_TREE); \
# git pull && git checkout $(TOOLCHAIN))
install: install_bins install_python_scripts
# rsync -a --exclude '.git' --exclude '.gitignore' $(WORKTREE)/* $(INSTALL_TREE)
# rsync -a --exclude '.git' --exclude '.gitignore' $(AUX_DIRS) $(INSTALL_TREE)
# (cd $(INSTALL_TREE); \
# git add -A --ignore-removal bin lib && \
# git commit --allow-empty -a -m "committed by $$USER from `hostname` at `date`")
# push: install
# (cd $(INSTALL_TREE); \
# git push)
build: $(QIBUILDS) cookies/configure-$(TOOLCHAIN)
for qb in $(QIBUILDS); do \
d=`dirname $$qb`; \
(cd $$d; pwd; qibuild make $(QI_MAKE_OPTS)) \
done
$(WORKTREE)/.qi:
cd $(WORKTREE); qibuild init; qibuild add-config pepper -t pepper; qibuild add-config linux64 -t linux64
cookies/configure-$(TOOLCHAIN): $(QIBUILDS) $(WORKTREE)/.qi $(PNPTRANS)
for qb in $(QIBUILDS); do \
d=`dirname $$qb`; \
(cd $$d; pwd; qibuild configure $(QI_CONF_OPTS)) \
done
mkdir -p cookies; touch $@
configure: $(PNPTRANS) cookies/configure-$(TOOLCHAIN)
reconfigure:
-rm cookies/configure-$(TOOLCHAIN)
$(MAKE) configure