propellor/Makefile

62 lines
2.5 KiB
Makefile
Raw Normal View History

CABAL?=cabal
DEBDEPS=gnupg ghc cabal-install libghc-missingh-dev libghc-ansi-terminal-dev libghc-ifelse-dev libghc-unix-compat-dev libghc-hslogger-dev libghc-network-dev libghc-quickcheck2-dev libghc-mtl-dev libghc-monadcatchio-transformers-dev
2014-11-25 15:38:42 +00:00
# this target is provided to keep old versions of the propellor cron job
# working, and will eventually be removed
run: deps build
2014-03-30 06:51:21 +00:00
./propellor
2014-03-31 20:20:38 +00:00
dev: build tags
2014-03-30 06:57:02 +00:00
2014-03-30 06:48:01 +00:00
deps:
@if [ $$(whoami) = root ]; then apt-get --no-upgrade --no-install-recommends -y install $(DEBDEPS) || (apt-get update && apt-get --no-upgrade --no-install-recommends -y install $(DEBDEPS)); fi || true
2014-04-24 04:45:39 +00:00
@if [ $$(whoami) = root ]; then apt-get --no-upgrade --no-install-recommends -y install libghc-async-dev || (cabal update; cabal install async); fi || true
2014-03-30 06:48:01 +00:00
2014-11-22 16:09:53 +00:00
install: propellor.1
install -d $(DESTDIR)/usr/bin $(DESTDIR)/usr/src/propellor
2014-06-09 16:29:33 +00:00
install -s dist/build/propellor/propellor $(DESTDIR)/usr/bin/propellor
2014-08-19 19:02:12 +00:00
mkdir -p dist/gittmp
2014-08-19 21:34:25 +00:00
$(CABAL) sdist
cat dist/propellor-*.tar.gz | (cd dist/gittmp && tar zx --strip-components=1)
2014-08-19 21:30:10 +00:00
# cabal sdist does not preserve symlinks, so copy over file
cd dist/gittmp && for f in $$(find -type f); do rm -f $$f; cp -a ../../$$f $$f; done
2014-08-19 19:02:12 +00:00
cd dist/gittmp && git init && \
git add . \
2014-08-19 19:29:32 +00:00
&& git commit -q -m "distributed version of propellor" \
2014-08-19 19:24:18 +00:00
&& git bundle create $(DESTDIR)/usr/src/propellor/propellor.git master HEAD \
2014-08-19 19:29:32 +00:00
&& git show-ref master --hash > $(DESTDIR)/usr/src/propellor/head
2014-08-19 19:02:12 +00:00
rm -rf dist/gittmp
2014-03-30 04:08:02 +00:00
2014-11-22 16:09:53 +00:00
propellor.1: doc/usage.mdwn doc/mdwn2man
doc/mdwn2man propellor 1 < doc/usage.mdwn > propellor.1
clean:
2014-11-22 16:09:53 +00:00
rm -rf dist Setup tags propellor propellor.1 privdata/local
find -name \*.o -exec rm {} \;
find -name \*.hi -exec rm {} \;
# hothasktags chokes on some template haskell etc, so ignore errors
2014-05-19 15:10:05 +00:00
# duplicate tags with Propellor.Property. removed from the start, as we
# often import qualified by just the module base name.
tags:
2014-05-19 20:52:06 +00:00
find . | grep -v /.git/ | grep -v /tmp/ | grep -v /dist/ | grep -v /doc/ | egrep '\.hs$$' | xargs hothasktags | perl -ne 'print; s/Propellor\.Property\.//; print' | sort > tags 2>/dev/null
2014-03-31 00:46:31 +00:00
# Upload to hackage.
hackage:
@cabal sdist
@cabal upload dist/*.tar.gz
2014-03-31 00:46:31 +00:00
.PHONY: tags
# The rules below are only used when bootstrapping new propellor
# installations; propellor contains equivilant haksell code.
build: dist/setup-config
@if ! $(CABAL) build; then $(CABAL) configure; $(CABAL) build; fi
@ln -sf dist/build/propellor-config/propellor-config propellor
dist/setup-config: propellor.cabal
@if [ "$(CABAL)" = ./Setup ]; then ghc --make Setup; fi
@$(CABAL) configure