summaryrefslogtreecommitdiff
path: root/tools/apbuild/Makefile
blob: 0b0441b4fb791a296e69fe200657560e1e71076a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
.PHONY: all install uninstall

PREFIX:=$(shell test x"`id -u`" = "x0" && if test -f /usr/bin/apgcc; then echo /usr; else echo /usr/local; fi || echo ~/.local)
BINDIR:=$(PREFIX)/bin
PERLDIR:=$(PREFIX)/share/apbuild
INCLUDEDIR:=$(PREFIX)/include/apbuild
ACLOCALDIR:=$(PREFIX)/share/aclocal

PACKAGE=apbuild
# Don't forget to bump the version in apgcc too.
VERSION=2.0.9

PROGS:=apgcc apg++ relaytool scandeps make-icons

all:
	@echo No compilation is required. To install, type 'make install'.
	@echo "(Current prefix=$(PREFIX))"

install:
	mkdir -p $(BINDIR)
	cp $(PROGS) $(BINDIR)
	chmod +x $(BINDIR)/apgcc $(BINDIR)/apg++ $(BINDIR)/scandeps $(BINDIR)/make-icons $(BINDIR)/relaytool
	mkdir -p $(PERLDIR)/Apbuild
	cp Apbuild/*.pm $(PERLDIR)/Apbuild/
	mkdir -p $(INCLUDEDIR)
	cp ctype.h apsymbols.h $(INCLUDEDIR)
	mkdir -p $(ACLOCALDIR)
	cp relaytool.m4 $(ACLOCALDIR)
	echo >> $(INCLUDEDIR)/apsymbols.h
	echo "/* apbuild version" $(VERSION) "*/" >> $(INCLUDEDIR)/apsymbols.h
	@echo --------------
	@echo "Installation complete. Please read README for usage."

uninstall:
	rm -f $(addprefix $(BINDIR)/, $(PROGS))
	rm -f $(PERLDIR)/Apbuild/*.pm
	rmdir $(PERLDIR)/Apbuild $(PERLDIR)
	rm -f $(INCLUDEDIR)/ctype.h
	rm -f $(INCLUDEDIR)/apsymbols.h
	rm -f $(ACLOCALDIR)/relaytool.m4

distdir:
	rm -rf $(PACKAGE)-$(VERSION)
	mkdir $(PACKAGE)-$(VERSION)
	cp -R BINARY-PORTABILITY-NOTES Makefile apsymbols.h ctype.h README $(PROGS) buildlist relaytool.m4 $(PACKAGE)-$(VERSION)/
	mkdir $(PACKAGE)-$(VERSION)/test-app
	mkdir $(PACKAGE)-$(VERSION)/Apbuild
	cp Apbuild/*.pm $(PACKAGE)-$(VERSION)/Apbuild/
	cp test-app/randomapp1.c $(PACKAGE)-$(VERSION)/test-app/

dist: distdir
	rm -f $(PACKAGE)-$(VERSION).tar.gz
	tar -cf $(PACKAGE)-$(VERSION).tar $(PACKAGE)-$(VERSION)
	gzip --best $(PACKAGE)-$(VERSION).tar
	rm -rf $(PACKAGE)-$(VERSION)