| 1 |
include VERSION |
| 2 |
|
| 3 |
SHELL=/bin/bash |
| 4 |
DESTDIR=$(shell pwd)/debian/tmp |
| 5 |
export DOCDIR = $(shell pwd)/debian/fai-doc/usr/share/doc/fai-doc |
| 6 |
LIBDIR = $(DESTDIR)/usr/lib/fai |
| 7 |
SHAREDIR = $(DESTDIR)/usr/share/fai |
| 8 |
USRSBIN_SCRIPTS = fai-make-nfsroot fai-setup fcopy ftar install_packages fai-chboot fai-monitor fai-cd fai faireboot fai-statoverride setup-storage dhcp-edit fai-new-mac fai-diskimage mk-data-partition |
| 9 |
|
| 10 |
USRBIN_SCRIPTS = fai-class fai-do-scripts fai-mirror fai-debconf policy-rc.d.fai ainsl fai-link fai-sed fai-monitor-gui fai-deps fai-mk-configspace ifclass |
| 11 |
|
| 12 |
# for syntax checks |
| 13 |
BASH_SCRIPTS = bin/fai bin/fai-cd bin/fai-class bin/fai-debconf bin/fai-do-scripts bin/fai-make-nfsroot bin/fai-mirror bin/fai-setup bin/fai-diskimage bin/fai-statoverride bin/faireboot bin/ftar bin/fai-link bin/fai-sed dev-utils/fai-kvm dev-utils/fai-mk-network examples/simple/basefiles/mk-basefile examples/simple/class/*.sh examples/simple/class/[0-9]* examples/simple/files/etc/rc.local/FAISERVER examples/simple/hooks/* examples/simple/scripts/*/* lib/fai-divert lib/fai-mount-disk lib/fai-savelog lib/fetch-basefile lib/get-boot-info lib/get-config-dir* lib/mkramdisk lib/mount2dir lib/prcopyleft lib/subroutines lib/task_* lib/updatebase lib/dracut/*/* bin/fai-mk-configspace bin/mk-data-partition lib/terminal-wrapper lib/fai-disk-info |
| 14 |
SHELL_SCRIPTS = bin/policy-rc.d.fai lib/check_status lib/create_resolv_conf lib/fai-abort lib/load_keymap_consolechars utils/mkdebmirror |
| 15 |
PERL_SCRIPTS = lib/setup-storage/*.pm bin/ainsl bin/dhcp-edit bin/fai-chboot bin/fai-deps bin/fai-monitor bin/fai-monitor-gui bin/fai-new-mac bin/fcopy bin/install_packages bin/setup-storage dev-utils/setup-storage_deps-graph.pl examples/simple/tests/Faitest.pm lib/dhclient-perl lib/fai-savelog-ftp bin/ifclass |
| 16 |
|
| 17 |
# do not include setup-storage and dracut subdir |
| 18 |
EXCL=lib/dracut lib/setup-storage lib/fai-abort |
| 19 |
libfiles=$(filter-out $(EXCL),$(wildcard lib/[a-z]*)) |
| 20 |
|
| 21 |
all: |
| 22 |
$(MAKE) syntaxcheck |
| 23 |
$(MAKE) -C doc all |
| 24 |
|
| 25 |
syntaxcheck: bashismcheck shellcheck perlcheck |
| 26 |
|
| 27 |
bashismcheck: |
| 28 |
@if [ -x "$$(which checkbashisms 2>/dev/null)" ]; then \ |
| 29 |
echo -n "Checking for bashisms"; \ |
| 30 |
for SCRIPT in $(SHELL_SCRIPTS); do \ |
| 31 |
test -r $${SCRIPT} || continue ; \ |
| 32 |
ec=0 ; \ |
| 33 |
checkbashisms -x $${SCRIPT} || ec=$$? ; \ |
| 34 |
if [ $${ec} -ne 0 ] && [ $${ec} -ne 2 ] ; then exit $${ec} ; fi ; \ |
| 35 |
echo -n "."; \ |
| 36 |
done; \ |
| 37 |
echo " done."; \ |
| 38 |
else \ |
| 39 |
echo "W: checkbashisms - command not found"; \ |
| 40 |
echo "I: checkbashisms can be optained from: "; \ |
| 41 |
echo "I: http://git.debian.org/?p=devscripts/devscripts.git"; \ |
| 42 |
echo "I: On Debian systems, checkbashisms can be installed with:"; \ |
| 43 |
echo "I: apt-get install devscripts"; \ |
| 44 |
fi |
| 45 |
|
| 46 |
shellcheck: |
| 47 |
@echo -n "Checking for shell syntax errors"; \ |
| 48 |
for SCRIPT in $(BASH_SCRIPTS) $(SHELL_SCRIPTS); do \ |
| 49 |
test -r $${SCRIPT} || continue ; \ |
| 50 |
bash -n $${SCRIPT} || exit ; \ |
| 51 |
echo -n "."; \ |
| 52 |
done; \ |
| 53 |
echo " done."; \ |
| 54 |
|
| 55 |
perlcheck: |
| 56 |
@echo "Checking for perl syntax errors:"; \ |
| 57 |
mkdir -p perl-dummy/Linux perl-dummy/File perl-dummy/Tk ; \ |
| 58 |
for f in File/lchown.pm Linux/LVM.pm Tk.pm Tk/HList.pm Tk/ItemStyle.pm; do \ |
| 59 |
echo '1;' > perl-dummy/$$f ; \ |
| 60 |
done; \ |
| 61 |
cp -a lib/Eval perl-dummy; \ |
| 62 |
for SCRIPT in $(PERL_SCRIPTS); do \ |
| 63 |
test -r $${SCRIPT} || continue ; \ |
| 64 |
perl -Iperl-dummy/ -Ilib/setup-storage/ -w -c $${SCRIPT} || exit ; \ |
| 65 |
done; \ |
| 66 |
rm -r perl-dummy ; \ |
| 67 |
echo "-> perl check done."; \ |
| 68 |
|
| 69 |
clean: |
| 70 |
rm -rf perl-dummy |
| 71 |
$(MAKE) -C doc clean |
| 72 |
|
| 73 |
veryclean: clean |
| 74 |
$(MAKE) -f debian/rules clean |
| 75 |
|
| 76 |
install: |
| 77 |
mkdir -p $(DESTDIR)/{sbin,man} $(DESTDIR)/etc/{modutils,apt/apt.conf.d} |
| 78 |
mkdir -p $(DESTDIR)/usr/{sbin,bin} $(DESTDIR)/usr/lib/fai $(DESTDIR)/etc/fai/apt/sources.list.d |
| 79 |
mkdir -p $(SHAREDIR)/{pixmaps/small,setup-storage} |
| 80 |
mkdir -p $(DESTDIR)/usr/lib/dracut/modules.d |
| 81 |
install man/* $(DESTDIR)/man |
| 82 |
pod2man -c '' -r '' -s8 bin/dhcp-edit > $(DESTDIR)/man/dhcp-edit.8 |
| 83 |
pod2man -c '' -r '' -s8 bin/fai-deps > $(DESTDIR)/man/fai-deps.8 |
| 84 |
$(MAKE) -C doc install |
| 85 |
-install $(libfiles) $(LIBDIR) |
| 86 |
cp -a lib/dracut/50fai-autodiscover $(DESTDIR)/usr/lib/dracut/modules.d |
| 87 |
install lib/setup-storage/* $(SHAREDIR)/setup-storage |
| 88 |
cd bin ; install $(USRSBIN_SCRIPTS) $(DESTDIR)/usr/sbin |
| 89 |
cd bin ; install $(USRBIN_SCRIPTS) $(DESTDIR)/usr/bin |
| 90 |
install dev-utils/fai-kvm $(DESTDIR)/usr/bin |
| 91 |
install dev-utils/fai-mk-network $(DESTDIR)/usr/sbin |
| 92 |
install -m644 conf/dhcpcd.conf $(SHAREDIR)/ |
| 93 |
install -m644 conf/apt.conf $(DESTDIR)/etc/apt/apt.conf.d/90fai |
| 94 |
cd conf ; install -m644 fai.conf grub.cfg grub.cfg.autodiscover grub.cfg.live $(DESTDIR)/etc/fai/ |
| 95 |
install -m644 conf/nfsroot.conf $(DESTDIR)/etc/fai/ |
| 96 |
install -m644 conf/sources.list $(DESTDIR)/etc/fai/apt/ |
| 97 |
install -m644 conf/fai-project.sources $(DESTDIR)/etc/fai/apt/sources.list.d |
| 98 |
install -m644 conf/NFSROOT $(DESTDIR)/etc/fai |
| 99 |
install -m755 lib/fai-abort $(LIBDIR) |
| 100 |
cp -a pixmaps/*.gif $(SHAREDIR)/pixmaps |
| 101 |
cp -a pixmaps/small/*.gif $(SHAREDIR)/pixmaps/small |
| 102 |
sed -i 's/FAIVERSIONSTRING/$(VERSIONSTRING)/' $(DESTDIR)/usr/sbin/fai |
| 103 |
cp -a examples $(DOCDIR) |
| 104 |
rm -f $(DOCDIR)/examples/simple/.git |
| 105 |
cp -a utils $(DOCDIR)/examples |
| 106 |
# Systemd |
| 107 |
mkdir -p $(DESTDIR)/usr/lib/systemd/system |
| 108 |
install -m644 conf/systemd/* $(DESTDIR)/usr/lib/systemd/system |
| 109 |
mkdir -p $(DESTDIR)/usr/share/perl5 |
| 110 |
cp -a lib/Eval $(DESTDIR)/usr/share/perl5 |
| 111 |
|
| 112 |
.PHONY: clean veryclean |