makedist/Makefile

88 lines
3.1 KiB
Makefile

# makedist Makefile for installation and packaging
# Copyright (c) 2003-2024 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
include makedist/VERSION
package = makedist
distdir = $(package)-$(makedist_version)
dist_archive = $(package)-$(makedist_version).tar.bz2
prefix := /usr
datadir := $(prefix)/share
sysconfdir := /etc
bindir := $(prefix)/bin
localedir := $(datadir)/locale/
localstatedir := /var
makediststatedir := $(localstatedir)/makedist
recordvmstatedir := $(makediststatedir)/recordvm
INSTALL = /usr/bin/install
INSTALL_PROGRAM = ${INSTALL} -m 755
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_DIR = ${INSTALL} -d -m 755
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
pck_catalogs := $(wildcard po/*.po)
.po.mo:; msgfmt $< -o $@
.SUFFIXES:
.SUFFIXES: .in .po .mo
locales: $(pck_catalogs:.po=.mo)
# TODO: test next time for integration:
# xgettext -o makedist.pot -L shell --keyword --keyword=GETTEXT bin/makedist-announcement makedist/makedist-announcement.sh
# msgmerge po/it.po makedist.pot --update
install-locales: locales
@install -d $(DESTDIR)$(localedir)
@for f in $(pck_catalogs); do\
lang=`echo $$f | sed 's,.*/\(.*\)\.po,\1,'`;\
echo "installing i18n file for language \`$$lang'...";\
dir="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES";\
$(INSTALL_DIR) $$dir;\
$(INSTALL_DATA) $${f/.po/.mo} $$dir/makedist.mo;\
done
dist: clean
@mkdir /tmp/$(distdir)
cp -a * /tmp/$(distdir)/
@rm -f $(dist_archive)
tar cf - -C /tmp $(distdir) | bzip2 -9 -c > $(dist_archive)
@rm -rf /tmp/$(distdir)
@echo "file \`$(dist_archive)' created"
dist-rpm: dist
@rpm_sourcedir=`rpm --eval=%{_sourcedir}`;\
mv -f $(package)-$(makedist_version).tar.bz2 $$rpm_sourcedir;\
echo "and saved as \`$$rpm_sourcedir/$(dist_archive)'"
clean:
@rm -fr $(dist_archive)
install: install-locales
@install -d $(DESTDIR)$(datadir);\
cp -a makedist $(DESTDIR)$(datadir)/;\
install -d $(DESTDIR)$(sysconfdir)/makedist;\
cp -a config/config $(DESTDIR)$(sysconfdir)/makedist/config;\
install -d $(DESTDIR)$(sysconfdir)/sysconfig;\
cp -a config/makedist $(DESTDIR)$(sysconfdir)/sysconfig/makedist;\
install -d $(DESTDIR)$(sysconfdir)/cron.daily;\
cp -a config/20-makedist-autobuild $(DESTDIR)$(sysconfdir)/cron.daily/20-makedist-autobuild;\
cp -a config/30-makedist-autobuild-cleanold $(DESTDIR)$(sysconfdir)/cron.daily/30-makedist-autobuild-cleanold;\
install -d $(DESTDIR)$($recordvmstatedir);\
cp -a var/recordvm-xinitrc $(DESTDIR)$(recordvmstatedir)/.xinitrc;\
cp -a var/recordvm-xvidcaprc $(DESTDIR)$(recordvmstatedir)/.xvidcaprc;\
cp -a var/recordvm-xorg.conf $(DESTDIR)$(recordvmstatedir)/xorg.conf;\
install -d $(DESTDIR)$(bindir);\
cp -a bin/makedist-recordvm $(DESTDIR)$(bindir)/makedist-recordvm
cp -a bin/makedist-newrelease $(DESTDIR)$(bindir)/makedist-newrelease
cp -a bin/makedist-announcement $(DESTDIR)$(bindir)/makedist-announcement
cp -a bin/makedist-docker $(DESTDIR)$(bindir)/makedist-docker