1#
2# Makefile for top level of zsh distribution
3#
4# Copyright (c) 1995-1997 Richard Coleman
5# All rights reserved.
6#
7# Permission is hereby granted, without written agreement and without
8# license or royalty fees, to use, copy, modify, and distribute this
9# software and to distribute modified versions of this software for any
10# purpose, provided that the above copyright notice and the following
11# two paragraphs appear in all copies of this software.
12#
13# In no event shall Richard Coleman or the Zsh Development Group be liable
14# to any party for direct, indirect, special, incidental, or consequential
15# damages arising out of the use of this software and its documentation,
16# even if Richard Coleman and the Zsh Development Group have been advised of
17# the possibility of such damage.
18#
19# Richard Coleman and the Zsh Development Group specifically disclaim any
20# warranties, including, but not limited to, the implied warranties of
21# merchantability and fitness for a particular purpose.  The software
22# provided hereunder is on an "as is" basis, and Richard Coleman and the
23# Zsh Development Group have no obligation to provide maintenance,
24# support, updates, enhancements, or modifications.
25#
26
27subdir = .
28dir_top = .
29SUBDIRS = Doc Etc Src Test
30
31@VERSION_MK@
32
33# source/build directories
34VPATH           = @srcdir@
35sdir            = @srcdir@
36sdir_top        = @top_srcdir@
37INSTALL         = @INSTALL@
38
39@DEFS_MK@
40
41# ========== DEPENDENCIES FOR BUILDING ==========
42
43# default target
44all: config.h config.modules
45	@for subdir in Src Doc; do \
46	  (cd $$subdir && $(MAKE) $(MAKEDEFS) $@) || exit 1; \
47	done
48
49# prepare module configuration
50prep:
51	@cd Src && $(MAKE) $(MAKEDEFS) $@
52
53META-FAQ: FORCE
54	@cd Doc && $(MAKE) $(MAKEDEFS) ../META-FAQ
55
56dvi ps html info pdf:
57	@cd Doc && $(MAKE) $(MAKEDEFS) $@
58
59# ========== DEPENDENCIES FOR INSTALLING ==========
60
61# install stripped
62install-strip:
63	$(MAKE) install STRIPFLAGS=""
64
65# install/uninstall most things
66install: install.bin install.modules install.fns install.man install.runhelp
67uninstall: uninstall.bin uninstall.modules uninstall.fns uninstall.man uninstall.runhelp
68
69# install/uninstall just the binary
70install.bin uninstall.bin:
71	@cd Src && $(MAKE) $(MAKEDEFS) $@
72
73# install/uninstall just the modules
74install.modules uninstall.modules:
75	@cd Src && $(MAKE) $(MAKEDEFS) $@
76
77# install/uninstall just the man pages
78install.man uninstall.man:
79	@cd Doc && $(MAKE) $(MAKEDEFS) $@
80
81# install/uninstall just the runhelp files
82install.runhelp uninstall.runhelp:
83	@cd Doc && $(MAKE) $(MAKEDEFS) $@
84
85# install/uninstall just the shell functions
86install.fns:
87	if test x$(fndir) != x && test x$(fndir) != xno; then \
88	  test x$(sitefndir) != xno && \
89	    $(SHELL) $(sdir_top)/mkinstalldirs $(DESTDIR)$(sitefndir); \
90	  sdir_top="$(sdir_top)" fndir="$(fndir)" dir_top="$(dir_top)" \
91	  scriptdir="$(scriptdir)" runhelpdir="$(runhelpdir)" \
92	  FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \
93	  INSTALL_DATA="$(INSTALL_DATA)" \
94	  INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
95	  DESTDIR="$(DESTDIR)" VERSION="$(VERSION)" \
96	  $(SHELL) $(sdir_top)/Config/installfns.sh || exit 1; \
97	fi; \
98	exit 0
99
100uninstall.fns:
101	if test x$(fndir) != x && test x$(fndir) != xno; then \
102	  fndir="$(fndir)" dir_top="$(dir_top)" \
103	  scriptdir="$(scriptdir)" \
104	  FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \
105	  DESTDIR="$(DESTDIR)" VERSION="$(VERSION)" \
106	  $(SHELL) $(sdir_top)/Config/uninstallfns.sh || exit 1; \
107	fi; \
108	exit 0
109
110# install/uninstall just the info pages
111install.info uninstall.info:
112	@cd Doc && $(MAKE) $(MAKEDEFS) $@
113
114# install/uninstall just the HTML manual
115install.html uninstall.html:
116	@cd Doc && $(MAKE) $(MAKEDEFS) $@
117
118# ========== DEPENDENCIES FOR TESTING ==========
119check test:
120	cd Test ; $(MAKE) check
121
122# ========== DEPENDENCIES FOR CLEANUP ==========
123
124@CLEAN_MK@
125
126distclean-here:
127	rm -f Makefile config.h config.status config.log config.cache config.modules config.modules.sh stamp-h Config/defs.mk
128	rm -rf autom4te.cache
129
130realclean-here:
131	cd $(sdir) && rm -f config.h.in stamp-h.in configure
132
133# ========== DEPENDENCIES FOR MAINTENANCE ==========
134
135@CONFIG_MK@
136
137config: config.h
138
139config.status: $(sdir)/configure
140	$(SHELL) ./config.status --recheck
141
142$(sdir)/configure: $(sdir)/aclocal.m4 $(sdir)/aczsh.m4 $(sdir)/configure.ac
143
144config.h: stamp-h
145stamp-h: $(sdir)/config.h.in config.status
146	cd $(dir_top) && $(SHELL) ./config.status config.h $@
147
148config.modules: $(sdir)/config.h.in config.status config.modules.sh
149	cd $(dir_top) && $(SHELL) ./config.status $@ && \
150	$(SHELL) ./config.modules.sh
151
152$(sdir)/config.h.in: $(sdir)/stamp-h.in
153$(sdir)/stamp-h.in: $(sdir)/configure.ac \
154		$(sdir)/aclocal.m4 $(sdir)/aczsh.m4
155	echo > $(sdir)/stamp-h.in
156
157# ========== DEPENDENCIES FOR DISTRIBUTION ==========
158
159DISTNAME = zsh-$(VERSION)
160
161targz-src: $(DISTNAME).tar.gz
162$(DISTNAME).tar.gz: FORCE
163	@$(sdir_top)/Util/mkdisttree.sh $(DISTNAME) $(sdir_top) $(dir_top) SRC \
164	    $(MAKE) $(MAKEDEFS)
165	echo '#define ZSH_PATCHLEVEL "'`cd $(sdir_top) && git describe --tags --long`'"' >$(DISTNAME)/Src/patchlevel.h.release
166	tar cf - $(DISTNAME) | gzip -9 > $@
167	rm -rf $(DISTNAME)
168
169targz-doc: $(DISTNAME)-doc.tar.gz
170$(DISTNAME)-doc.tar.gz: FORCE
171	@$(sdir_top)/Util/mkdisttree.sh $(DISTNAME) $(sdir_top) $(dir_top) DOC \
172	    $(MAKE) $(MAKEDEFS)
173	tar cf - $(DISTNAME) | gzip -9 > $@
174	rm -rf $(DISTNAME)
175
176FORCE:
177