-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
161 lines (137 loc) · 4.61 KB
/
Makefile.in
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# -----------------------------------------------------------------------------
#
# (c) 2011-2012 Tsitsimpis Ilias
#
# This file is part of the GAC build system.
#
# To understand how the build system works and how to modify it, see HACKING
#
# -----------------------------------------------------------------------------
prefix = @prefix@
exec_prefix = @exec_prefix@
builddir = @abs_top_builddir@/dist
bindir = @bindir@
datarootdir = @datarootdir@
docdir = @docdir@
libdir = @libdir@/${PACKAGE_TARNAME}
mandir = @mandir@
TAR = @TarCmd@
GZIP = @GZipCmd@
SED = @SedCmd@
INSTALL = @INSTALL@
INSTALL_PROG = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
ARCHIVE = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
.PHONY: all
all: build libraries
#### Build gac ####
###################
.PHONY: build
build: $(builddir)/$(PACKAGE_TARNAME)
$(MAKE) -C src $@
$(INSTALL_PROG) -D $(builddir)/build/$(PACKAGE_TARNAME)/$(PACKAGE_TARNAME) \
$(builddir)/inplace/bin/$(PACKAGE_TARNAME)
.PHONY: libraries
libraries: build $(builddir)/$(PACKAGE_TARNAME)
$(INSTALL_PROG) -D $(builddir)/build/$(PACKAGE_TARNAME)/$(PACKAGE_TARNAME) \
$(builddir)/inplace/bin/$(PACKAGE_TARNAME)
$(MAKE) -C libraries libdir="$(builddir)/inplace" \
gac="$(builddir)/$(PACKAGE_TARNAME)" install
$(builddir)/$(PACKAGE_TARNAME):
$(call shell-wrapper,'gac_shell',$(builddir)/inplace)
$(INSTALL_PROG) -D gac_shell $(builddir)/$(PACKAGE_TARNAME)
$(RM) gac_shell
##### Install gac #####
#######################
.PHONY: install
install: build
$(call shell-wrapper,'gac_shell',$(libdir))
$(INSTALL_PROG) -D gac_shell $(bindir)/$(PACKAGE_TARNAME)
$(RM) gac_shell
$(INSTALL_PROG) -D $(builddir)/build/$(PACKAGE_TARNAME)/$(PACKAGE_TARNAME) \
$(libdir)/bin/$(PACKAGE_TARNAME)
$(INSTALL_DATA) -D LICENSE $(docdir)/LICENSE
$(INSTALL_DATA) -D README $(docdir)/README
$(INSTALL_DATA) -D docs/alan2011.pdf $(docdir)/alan2011.pdf
$(SED) -e "s/\$$PACKAGE_NAME/$(subst /,\/,$(PACKAGE_NAME))/g" \
-e "s/\$$PACKAGE_TARNAME_U/\U$(subst /,\/,$(PACKAGE_TARNAME))/g" \
-e "s/\$$PACKAGE_TARNAME/$(subst /,\/,$(PACKAGE_TARNAME))/g" \
-e "s/\$$PACKAGE_VERSION/$(subst /,\/,$(PACKAGE_VERSION))/g" \
-e "s/\$$LIBDIR/$(subst /,\/,$(libdir))/g" \
< docs/man_page/gac.1 | $(GZIP) - > docs/man_page/gac.1.gz
$(INSTALL_DATA) -D docs/man_page/gac.1.gz $(mandir)/man1/$(PACKAGE_TARNAME).1.gz
$(RM) docs/man_page/gac.1.gz
$(MAKE) -C libraries gac="$(bindir)/$(PACKAGE_TARNAME)" \
libdir="$(libdir)" install
@echo "\n\nInstallation of $(ARCHIVE) was successful."
@echo "To use, add $(bindir) to your PATH."
.PHONY: uninstall
uninstall:
$(RM) $(bindir)/$(PACKAGE_TARNAME)
$(RM) -r $(libdir)
$(RM) -r $(docdir)
$(RM) $(mandir)/man1/$(PACKAGE_TARNAME).1.gz
##### Distribute gac #####
##########################
.PHONY: dist
dist:
@echo "Cleaning all the generated files.."
$(MAKE) maintainer-clean
$(RM) -r $(ARCHIVE)
$(RM) $(ARCHIVE).tar.gz
@echo "Copying files.."
mkdir $(ARCHIVE)
$(TAR) cf - --exclude=$(ARCHIVE) --exclude-vcs * | \
(cd $(ARCHIVE) && tar xf -)
@echo "Generating archive.."
$(TAR) zcf $(ARCHIVE).tar.gz $(ARCHIVE)
@echo "Cleaning temp files.."
$(RM) -r $(ARCHIVE)
.PHONY: distcheck
distcheck: dist
@echo "Unpacking the tar.."
tar xzf $(ARCHIVE).tar.gz
@echo "Configuring the dist package.."
(cd $(ARCHIVE) && ./configure)
@echo "Compiling the dist package.."
$(MAKE) -C $(ARCHIVE) all
@echo "Testing the dist package.."
$(MAKE) -C $(ARCHIVE) test
@echo "Cleaning temp files.."
$(RM) -r $(ARCHIVE)
##### Clean build dir #####
###########################
.PHONY: clean
clean:
$(MAKE) -C src clean
$(MAKE) -C testsuite clean
$(MAKE) -C libraries clean
$(RM) testsuite_summary.txt
.PHONY: distclean
distclean: clean
$(RM) Makefile src/Makefile src/config.h src/gac.cabal
$(RM) libraries/Makefile config.log config.status
.PHONY: maintainer-clean
maintainer-clean: distclean
$(RM) -r autom4te.cache
##### Test gac #####
####################
.PHONY: test
test:
$(MAKE) -C testsuite/tests CLEANUP=1 OUTPUT_SUMMARY=../../testsuite_summary.txt fast
.PHONY: fulltest
fulltest:
$(MAKE) -C testsuite/tests CLEANUP=1 OUTPUT_SUMMARY=../../testsuite_summary.txt
#### Shell Wrapper ####
#######################
# $1 shell name
# $2 topdir
define shell-wrapper
@echo '#!/bin/sh' > $1
@echo 'executable="$2/bin/$(PACKAGE_TARNAME)"' >> $1
@echo 'topdir="$2"' >> $1
@echo 'exec "$$executable" -B"$$topdir" $${1+"$$@"}' >> $1
endef