/ Makefile
Makefile
 1  CABAL?=cabal
 2  DATE := $(shell dpkg-parsechangelog 2>/dev/null | grep Date | cut -d " " -f2-)
 3  
 4  build: tags propellor.1 configured
 5  	$(CABAL) build
 6  	@if [ -d dist-newstyle ]; then \
 7  		ln -sf $$(cabal exec -- sh -c 'command -v propellor-config') propellor; \
 8  	else \
 9  		ln -sf dist/build/propellor-config/propellor-config propellor; \
10  	fi
11  
12  install:
13  	install -d $(DESTDIR)/usr/bin $(DESTDIR)/usr/src/propellor
14  	if [ -d dist-newstyle ]; then \
15  		install -s $$(cabal exec -- sh -c 'command -v propellor') $(DESTDIR)/usr/bin/propellor; \
16  	else \
17  		install -s dist/build/propellor/propellor $(DESTDIR)/usr/bin/propellor; \
18  	fi
19  	mkdir -p gittmp
20  	if [ "$(CABAL)" = ./Setup ]; then \
21  		./Setup sdist --output-directory=gittmp; \
22  	else \
23  		$(CABAL) sdist -o - | (cd gittmp && tar zx --strip-components=1); \
24  	fi
25  	# cabal sdist does not preserve symlinks, so copy over file
26  	cd gittmp && for f in $$(find -type f); do rm -f $$f; cp -a ../$$f $$f; done
27  	# reset mtime on files in git bundle so bundle is reproducible
28  	find gittmp -print0 | xargs -0r touch --no-dereference --date="$(DATE)"
29  	export GIT_AUTHOR_NAME=build \
30  	&& export GIT_AUTHOR_EMAIL=build@buildhost \
31  	&& export GIT_AUTHOR_DATE="$(DATE)" \
32  	&& export GIT_COMMITTER_NAME=build \
33  	&& export GIT_COMMITTER_EMAIL=build@buildhost \
34  	&& export GIT_COMMITTER_DATE="$(DATE)" \
35  	&& cd gittmp && git init \
36  	&& git add . \
37  	&& git commit -q -m "distributed version of propellor" \
38  	&& git bundle create $(DESTDIR)/usr/src/propellor/propellor.git master HEAD \
39  	&& git show-ref master --hash > $(DESTDIR)/usr/src/propellor/head
40  	rm -rf gittmp
41  
42  clean:
43  	rm -rf dist dist-newstyle configured Setup \
44  		tags propellor propellor.1 privdata/local
45  	find . -name \*.o -exec rm {} \;
46  	find . -name \*.hi -exec rm {} \;
47  
48  tags:
49  	@hasktags . -c 2>/dev/null || true
50  
51  configured: propellor.cabal
52  	@if [ "$(CABAL)" = ./Setup ]; then ghc --make Setup; fi
53  	@$(CABAL) configure
54  	touch configured
55  
56  propellor.1: doc/usage.mdwn doc/mdwn2man
57  	doc/mdwn2man propellor 1 < doc/usage.mdwn > propellor.1
58  
59  # Darwin tests (macOS only)
60  .PHONY: test-darwin-local test-darwin-system test-darwin-setup test-darwin test-darwin-clean
61  
62  # Quick local test - user-level LaunchAgents (no sudo needed)
63  test-darwin-local:
64  	@./test/darwin/test-local.sh
65  
66  # System-level test - LaunchDaemons (requires sudo)
67  test-darwin-system:
68  	@./test/darwin/test-system.sh
69  
70  # VM-based integration tests (requires Tart, Apple Silicon)
71  test-darwin-setup:
72  	@echo "Setting up Darwin test environment..."
73  	@./test/darwin/setup-tart.sh
74  
75  test-darwin: build
76  	@echo "Running Darwin integration tests..."
77  	@./test/darwin/run-tests.sh
78  
79  test-darwin-clean:
80  	@echo "Cleaning up Darwin test VMs..."
81  	@tart delete propellor-test-darwin 2>/dev/null || true
82  
83  .PHONY: tags