| 1 |
# (c) 2007 Quest Software, Inc. All rights reserved.
|
| 2 |
|
| 3 |
PP_SHELL= /bin/sh
|
| 4 |
INSTALLED_PP = /data/rc/pub/rc/polypkg/pp
|
| 5 |
|
| 6 |
PP_SRCS= \
|
| 7 |
pp.main \
|
| 8 |
pp.util \
|
| 9 |
pp.front \
|
| 10 |
pp.platform \
|
| 11 |
pp.expand \
|
| 12 |
pp.model \
|
| 13 |
pp.back \
|
| 14 |
pp.back.aix \
|
| 15 |
pp.back.aix.func \
|
| 16 |
pp.back.sd \
|
| 17 |
pp.back.sd.func \
|
| 18 |
pp.back.solaris \
|
| 19 |
pp.back.solaris.func \
|
| 20 |
pp.back.solaris.svc \
|
| 21 |
pp.back.deb \
|
| 22 |
pp.back.deb.svc \
|
| 23 |
pp.back.deb.func \
|
| 24 |
pp.back.kit \
|
| 25 |
pp.back.kit.svc \
|
| 26 |
pp.back.kit.kits \
|
| 27 |
pp.back.rpm \
|
| 28 |
pp.back.rpm.svc \
|
| 29 |
pp.back.rpm.func \
|
| 30 |
pp.back.macos \
|
| 31 |
pp.back.macos.func \
|
| 32 |
pp.back.inst \
|
| 33 |
pp.back.null \
|
| 34 |
pp.quest
|
| 35 |
|
| 36 |
all: pp pp-stripped check
|
| 37 |
cd example && $(MAKE)
|
| 38 |
@if test -x $(INSTALLED_PP); then \
|
| 39 |
echo "Polypkg versions:"; \
|
| 40 |
echo " installed (public): "`$(INSTALLED_PP) --version | cut -d' ' -f2`; \
|
| 41 |
echo " local: "`./$< --version | cut -d' ' -f2`; \
|
| 42 |
fi
|
| 43 |
|
| 44 |
# Generate a pp that includes the sources with the '.' operator.
|
| 45 |
# This is most handy for development because the source line numbers
|
| 46 |
# will be correct in error messages.
|
| 47 |
pp: $(PP_SRCS) .svn
|
| 48 |
rm -f $@
|
| 49 |
(echo '#!$(PP_SHELL)'; \
|
| 50 |
echo 'pp_revision="$(shell svnversion . | tr : _)"'; \
|
| 51 |
echo 'd=`dirname $$0`'; \
|
| 52 |
for p in $(PP_SRCS); do \
|
| 53 |
echo '. "$$d/'$$p'" &&'; \
|
| 54 |
done; \
|
| 55 |
echo 'pp_main "$$@"' \
|
| 56 |
) > $@
|
| 57 |
chmod 555 $@
|
| 58 |
|
| 59 |
# Generate an exportable pp script. Source files have their comments
|
| 60 |
# removed and are concatenated together to make the shippable pp script.
|
| 61 |
pp-stripped: $(PP_SRCS) .svn
|
| 62 |
(echo '#!$(PP_SHELL)'; \
|
| 63 |
echo "# (c) `date +%Y` Quest Software, Inc. All rights reserved"; \
|
| 64 |
echo 'pp_revision="$(shell svnversion . | tr : _)"'; \
|
| 65 |
cat pp.licence; \
|
| 66 |
sed -e '/^#/d' $(PP_SRCS); \
|
| 67 |
echo 'pp_main $${1+"$$@"}'; \
|
| 68 |
) > $@
|
| 69 |
chmod +x $@
|
| 70 |
|
| 71 |
clean:
|
| 72 |
rm -f pp pp-stripped tags
|
| 73 |
cd example && $(MAKE) clean
|
| 74 |
|
| 75 |
TEST_SHELL=sh
|
| 76 |
|
| 77 |
check: pp
|
| 78 |
@ex=0; for t in tests/t-*; do \
|
| 79 |
${TEST_SHELL} -f tests/driver $$t || ex=1; \
|
| 80 |
done; exit $$ex
|
| 81 |
|
| 82 |
# Create a tags file (used by vi). Shell functions are detected
|
| 83 |
# by being preceeded by a descriptive comment starting with '#@'
|
| 84 |
tags: $(PP_SRCS)
|
| 85 |
for f in $(PP_SRCS); do \
|
| 86 |
sed -n -e 's,^\(\([a-zA-Z_][a-zA-Z_0-9]*\)[ ]*(\))[ ]*{.*,\2 '$$f' /^\1/,p' \
|
| 87 |
-e 's,^\(\([a-zA-Z_][a-zA-Z_0-9]*\)=\).*,\2 '$$f' /^\1/,p' $$f; \
|
| 88 |
done |sort > $@
|
| 89 |
|
| 90 |
install: pp-stripped
|
| 91 |
@PPVER=`./pp-stripped --version | cut -d. -f 4`; \
|
| 92 |
case $$PPVER in \
|
| 93 |
*M*|*_*) \
|
| 94 |
echo "Refusing to install unclean version $$PPVER" >&2; \
|
| 95 |
exit 1;; \
|
| 96 |
esac
|
| 97 |
cp -f pp-stripped $(INSTALLED_PP)
|