coriolis/Makefile.LIP6

118 lines
4.9 KiB
Makefile

venv = source .venv/bin/activate
localpath = export PATH=${HOME}/.local/bin:${PATH};
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
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
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 "CORIOLIS_SRC = $(CORIOLIS_SRC)" ; \
echo "BUILDDIR = $(BUILDDIR)" ; \
echo "PREFIX = $(PREFIX)" ; \
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
$(HOME)/.local/bin/pdm:
@pip install pdm
$(CORIOLIS_SRC)/.pdm-plugins/bin/pdm: $(HOME)/.local/bin/pdm
@$(localpath) pdm install --no-self -d --plugins
configure:
@$(localpath) pdm run meson setup ${BUILDDIR} --prefix=$(PREFIX) -Dpython.install_env=prefix
install: check_dir $(CORIOLIS_SRC)/.pdm-plugins/bin/pdm configure
@$(localpath) pdm run 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 $(CORIOLIS_SRC)/.pdm-plugins/bin/pdm configure
@$(localpath) pdm run meson configure ${BUILDDIR} --prefix=$(PREFIX) \
-Donly-docs=true \
-Ddocs=true
@$(localpath) pdm run meson install -C $(BUILDDIR)
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 ${HOME}/.local
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..."; \
@$(localpath) pdm run ninja -C $(BUILDDIR) uninstall