blob: 348ddd9dc7836797976bd74c8854cc3e11257d8a [file] [log] [blame]
#---------------------------------------------------
# Makefile for efabless project open_pdks
# Tim Edwards, 11/21/2016
# Updated 10/19/2018 for use independently of the
# efabless /ef/ tree filesystem setup.
# Updated 5/5/2020 for use with the 2-stage install
#---------------------------------------------------
#
# Typical usage:
#
# make
# generates the tech files from source masters.
#
# make install
#
# installs the tech files. If the configuration
# script has been given the "--with-<PDK>-dist-path="
# option, then tech files are installed in the path
# (such as a git repository) that is used for
# distribution of software across a system. Otherwise,
# files are installed in the local path specified by
# the configuration option "--with-<PDK>-local-path=".
#
# make clean
#
# clean up all files generated by 'make'
#
# make veryclean
#
# clean up all files generated by 'make' and remove
# all log files.
#
# make uninstall
#
# remove the installed PDKs.
#
# make reference
#
# annotate the technology JSON file with the current
# commit state of all repositories used by the PDK to
# create a reference set of PDKs. Can be used with
# the configure --with-reference option to compile
# to sources from a specific set of commits.
#
#---------------------------------------------------
#
# The following definitions are tied to the contents
# of this repository and should not be changed.
TECHS = @ALL_TECHS@
ENABLED_TECHS = @ENABLED_TECHS@
DONE_MESSAGE = "Done."
ifeq ($(TECHS),)
DONE_MESSAGE = "No techs configured."
endif
TECHS_ALL = $(addprefix tech-,$(ENABLED_TECHS))
TECHS_UPDATE = $(addprefix update-,$(ENABLED_TECHS))
TECHS_INSTALL = $(addprefix install-,$(ENABLED_TECHS))
TECHS_UNINSTALL = $(addprefix uninstall-,$(TECHS))
TECHS_CLEAN = $(addprefix clean-,$(TECHS))
TECHS_VERYCLEAN = $(addprefix veryclean-,$(TECHS))
TECHS_REFERENCE = $(addprefix reference-,$(TECHS))
#---------------------------------------------------
.PHONY: all install uninstall clean veryclean update
all: $(TECHS_ALL)
@echo $(DONE_MESSAGE)
install: $(TECHS_INSTALL) common_install
@echo $(DONE_MESSAGE)
uninstall: $(TECHS_UNINSTALL)
@echo $(DONE_MESSAGE)
update: $(TECHS_UPDATE)
@echo $(DONE_MESSAGE)
reference: $(TECHS_REFERENCE)
@echo $(DONE_MESSAGE)
clean: $(TECHS_CLEAN)
@echo $(DONE_MESSAGE)
veryclean: $(TECHS_VERYCLEAN)
@echo $(DONE_MESSAGE)
distclean: $(TECHS_VERYCLEAN)
${RM} -rf sources
@echo $(DONE_MESSAGE)
#---------------------------------------------------
CPP = common/preproc.py
prefix = @prefix@
datarootdir = @datarootdir@
datadir = @datadir@
# NOTE: All scripts used by the project and design flow management
# system are in the "runtime" directory, except for cdl2spi.py and
# natural_sort.py, which are the two files used by scripts in both the
# common/ and runtime/ directories.
common_install:
@if test -w $(datadir) ; then \
mkdir -p $(datadir)/pdk/scripts/ ;\
mkdir -p $(datadir)/pdk/runtime ;\
for file in runtime/*.py ; do \
${CPP} -DPREFIX=$(datadir) $$file \
$(datadir)/pdk/$$file ;\
done ;\
for file in runtime/*.txt ; do \
${CPP} -DPREFIX=$(datadir) $$file \
$(datadir)/pdk/$$file ;\
done ;\
mv $(datadir)/pdk/runtime/* $(datadir)/pdk/scripts ;\
${CPP} -DPREFIX=$(datadir) common/cdl2spi.py $(datadir)/pdk/scripts/cdl2spi.py ;\
${CPP} -DPREFIX=$(datadir) common/natural_sort.py $(datadir)/pdk/scripts/natural_sort.py ;\
rm -r -f $(datadir)/pdk/runtime ;\
echo "Common install: Done." ;\
else \
echo "Common install: $(datadir) is not writeable (ignoring)." ;\
fi
#---------------------------------------------------
tech-%: %
(cd $* && ${MAKE} -j$(nproc) all)
#---------------------------------------------------
install-%: %
(cd $* && ${MAKE} install)
uninstall-%: %
(cd $* && ${MAKE} uninstall)
update-%: %
(cd $* && ${MAKE} update)
reference-%: %
(cd $* && ${MAKE} reference)
clean-%:
(cd $* && ${MAKE} clean)
veryclean-%:
(cd $* && ${MAKE} veryclean)
#---------------------------------------------------