-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile.LIP6
158 lines (117 loc) · 5.92 KB
/
Makefile.LIP6
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
venv = source .venv/bin/activate;
REGRESSION_DIR =
ifneq ($(findstring nightly,$(shell pwd)),)
REGRESSION_DIR = /nightly
endif
ifneq ($(findstring runner,$(shell pwd)),)
REGRESSION_DIR = /work/coriolis/coriolis
endif
SMP_FLAGS =
ifneq ($(shell which nproc 2> /dev/null),)
SMP_FLAGS = -j$(shell nproc)
endif
ifeq ($(findstring abuild/rpmbuild,$(shell pwd)),)
$(info Using LIP6 build directory tree scheme)
SRC_DIR = ${HOME}$(REGRESSION_DIR)/coriolis-2.x/src
CORIOLIS_SRC = ${SRC_DIR}/coriolis
ALLIANCE_SRC = ${SRC_DIR}/alliance/alliance/src
BUILDTYPE = release
BUILDDIR = ${HOME}$(REGRESSION_DIR)/coriolis-2.x/$(BUILDTYPE)/build
PREFIX = ${HOME}$(REGRESSION_DIR)/coriolis-2.x/$(BUILDTYPE)/install
else
$(info Using rpmbuild directory tree scheme)
SRC_DIR = ${HOME}/rpmbuild/BUILD
CORIOLIS_SRC = ${SRC_DIR}/coriolis-eda-2.5.5
ALLIANCE_SRC = ${SRC_DIR}/alliance/alliance/src
BUILDDIR = ${CORIOLIS_SRC}/build
PREFIX = /usr
endif
PDM_BIN = $(CORIOLIS_SRC)/.venv/bin/pdm
MESON_BIN = $(CORIOLIS_SRC)/.venv/bin/meson
PELICAN_BIN = $(CORIOLIS_SRC)/.venv/bin/pelican
help:
@echo "============================================================================"; \
echo "Coriolis build & install top Makefile"; \
echo ""; \
echo "This Makefile is intended *only* for LIP6 users"; \
echo ""; \
echo "To build it, simply type (in coriolis/, at the shell prompt):"; \
echo " ego@home:coriolis> make install"; \
echo "To remove the build directory (and keep the software installed):"; \
echo " ego@home:coriolis> make clean_build"; \
echo "To fully remove build & install:"; \
echo " ego@home:coriolis> make uninstall"; \
echo "============================================================================"; \
echo "SMP_FLAGS = $(SMP_FLAGS)" ; \
echo "SRC_DIR = $(SRC_DIR)" ; \
echo "CORIOLIS_SRC = $(CORIOLIS_SRC)" ; \
echo "BUILDDIR = $(BUILDDIR)" ; \
echo "PREFIX = $(PREFIX)" ; \
echo "DESTDIR = $(DESTDIR)" ; \
echo "============================================================================";
check_dir:
@if [ "`pwd`" != "${CORIOLIS_SRC}" ]; then \
echo "Coriolis uses a fixed directory from the user's root."; \
echo "You must put in:"; \
echo " <${CORIOLIS_SRC}>"; \
echo "Instead of:"; \
echo " <`pwd`>"; \
echo "Stopping build."; \
exit 1; \
fi
$(CORIOLIS_SRC)/.venv:
python3 -m venv .venv
$(MESON_BIN): $(CORIOLIS_SRC)/.venv
$(venv) if [ ! -x "$(MESON_BIN)" ]; then pip install meson; fi
$(PELICAN_BIN): $(CORIOLIS_SRC)/.venv
$(venv) if [ ! -x "$(PELICAN_BIN)" ]; then pip install pelican; fi
ifeq ($(USE_SYSTEM_PDM),)
$(PDM_BIN): $(CORIOLIS_SRC)/.venv
$(venv) if [ ! -x "$(PDM_BIN)" ]; then pip install pdm; pdm install --no-self -d --plugins; fi
install_venv: $(PDM_BIN) $(MESON_BIN) $(PELICAN_BIN)
else
install_venv: $(MESON_BIN) $(PELICAN_BIN)
endif
wipe: check_dir install_venv
$(venv) meson setup ${BUILDDIR} --wipe -Dpython.install_env=prefix -Donly-docs=false
setup: check_dir install_venv
$(venv) meson setup ${BUILDDIR} --prefix=$(PREFIX) -Dpython.install_env=prefix -Donly-docs=false
configure: check_dir install_venv
$(venv) meson configure ${BUILDDIR} --prefix=$(PREFIX) -Dpython.install_env=prefix
install: setup configure
$(venv) meson install -C $(BUILDDIR)
@echo ""; \
echo "============================================================================"; \
echo "Coriolis has been successfully built"; \
echo "============================================================================"; \
echo "It has been installed under the directory:"; \
echo " $(PREFIX)/{bin,lib,lib64,include,share,...}"; \
echo "============================================================================";
install_docs: check_dir configure
$(venv) echo "PYTHON=`which python`"
$(venv) meson configure ${BUILDDIR} --prefix=$(PREFIX) -Ddocs=true
$(venv) meson install -C $(BUILDDIR)
@echo "Documentation generated and installed."
install_alliance:
export ALLIANCE_TOP=$(PREFIX); \
export LD_LIBRARY_PATH=$(PREFIX)/lib:$(LD_LIBRARY_PATH); \
cd $(ALLIANCE_SRC); \
sed -i 's,dirs="\\$$newdirs documentation",dirs="$$newdirs",' ./autostuff; \
./autostuff clean; \
./autostuff; \
mkdir -p $(BUILDDIR); \
cd $(BUILDDIR); \
$(ALLIANCE_SRC)/configure --prefix=$(PREFIX) --enable-alc-shared; \
make -j1 install
clean_build: check_dir
@echo "Removing the build tree only."; \
echo " $(BUILDDIR)"; \
rm -rf $(BUILDDIR)
clean_pdm:
@echo "Removing all pip, pdm & venv installed files."
rm -rf ${CORIOLIS_SRC}/.venv
rm -f ${CORIOLIS_SRC}/.pdm_python
rm -rf ${CORIOLIS_SRC}/.pdm_plugins
uninstall: check_dir
@echo "Removing the whole build & install tree..."; \
@$(venv) ninja -C $(BUILDDIR) uninstall