1#
2# This GNUmakefile needs to build the gnustep-make documentation.
3#
4
5# The GNUmakefile itself is written using gnustep-make.  If we find an
6# existing gnustep-make installation, we use it.  Otherwise, we
7# configure, compile and install gnustep-make into a temporary
8# subdirectory, then we use that copy.
9
10# In the very unlikely event that gnustep-make does not even install
11# on your machine, please get a pre-generated copy of the
12# documentation from the internet!  Or just read the documentation in
13# source format. :-)
14
15# As a special case, if gnustep-make has been configured (GNUstep.conf exists)
16# in the enclosing directory, and has not yet been installed (GNUSTEP_MAKEFILES
17# is not defined), we attempt to use the uninstalled version.
18#
19# As all makefile fragments in the source tree are positioned relative to
20# each other in the same way they're installed, this works fine.
21#
22# If future changes happen to introduce different behaviour between the
23# makefile fragments in the source tree and installed ones (which is not
24# a trivial change), this strategy has to be reviewed.  One possible solution
25# then is to install make into a temporary directory (DESTDIR?) first, then to
26# use these.
27#
28
29ifeq ($(GNUSTEP_MAKEFILES),)
30  ifeq ($(wildcard ../GNUstep.conf),../GNUstep.conf)
31    GNUSTEP_MAKEFILES=..
32  endif
33endif
34
35ifeq ($(GNUSTEP_MAKEFILES),)
36
37# We have no gnustep-make installation to use.  We need gnustep-make
38# to generate the documentation.
39
40# To help lazy cows who want to type 'make' and have all work
41# automatically without installating gnustep-make first, if we don't
42# have a gnustep-make installation to use, we create a temporary one
43# in the subdirectory ./tmp-installation, the run make again passing
44# GNUSTEP_MAKEFILES set to point to the new makefile installation
45
46CURRENT_DIR = $(shell pwd)
47
48# To execute all, or clean, we first depend on a local
49# temporary installation of gnustep-make; when we have it, we source
50# GNUstep.sh, then we run the make command again.
51all regenerate: ./tmp-installation/System/Library/Makefiles
52	@echo "** Running 'make $@' using the local/temporary gnustep-make installation **"
53	$(MAKE) $@ GNUSTEP_MAKEFILES="$(CURRENT_DIR)/tmp-installation/System/Library/Makefiles"
54	@echo "** Finished local/temporary documentation in $(CURRENT_DIR)/tmp-installation. **"
55	@echo "** Use an installed gnustep-make if you wish to install documentation. **"
56
57clean: ./tmp-installation/System/Library/Makefiles
58	$(MAKE) $@ GNUSTEP_MAKEFILES="$(CURRENT_DIR)/tmp-installation/System/Library/Makefiles"
59
60install:
61	@echo "** To install the documentation you first install/set-up gnustep-make **"
62
63# This creates a local temporary installation of GNUstep-make
64./tmp-installation/System/Library/Makefiles:
65	@echo "** No gnustep-make installation found, attempting to create a local/temporary one. **"
66	(mkdir tmp-build; \
67	cd tmp-build; \
68	../../configure --prefix="$(CURRENT_DIR)/tmp-installation" \
69			--with-layout=gnustep \
70	                --with-config-file="$(CURRENT_DIR)/tmp-installation/GNUstep.conf"; \
71	make; \
72	make install)
73
74distclean:
75	-(if [ -f ./tmp-installation/System/Library/Makefiles/common.make ]; then \
76	  $(MAKE) $@ GNUSTEP_MAKEFILES="$(CURRENT_DIR)/tmp-installation/System/Library/Makefiles"; \
77	fi)
78	rm -Rf tmp-installation tmp-build
79
80else
81
82# We have a gnustep-make installation to use.  The following is a
83# normal gnustep-make GNUmakefile for documentation.
84
85# We normally install into System
86GNUSTEP_INSTALLATION_DOMAIN = SYSTEM
87
88include $(GNUSTEP_MAKEFILES)/common.make
89
90# The documents to be generated
91
92# We should prefix everything with 'gnustep' because we generate info
93# files that we then put into the standard info directories, and we
94# don't want those to conflict with info files from other packages!
95DOCUMENT_NAME = gnustep-howto gnustep-faq gnustep-filesystem gnustep-internals gnustep-make gnustep-userfaq
96
97# The text documents to be generated
98DOCUMENT_TEXT_NAME = INSTALL README NEWS RELEASENOTES ANNOUNCE
99
100TOP_DOC_FILES = INSTALL README NEWS RELEASENOTES ANNOUNCE
101README_FILES = README.Darwin README.MinGWOnCygwin README.Cygwin \
102	README.MinGW
103
104
105GNUstep-HOWTO_TEXI_FILES = version.texi
106GNUstep-HOWTO_TEXT_MAIN = gnustep-howto.texi
107GNUstep-HOWTO_DOC_INSTALL_DIR = User/GNUstep/
108
109FAQ_TEXI_FILES = version.texi
110FAQ_TEXT_MAIN = gnustep-faq.texi
111FAQ_DOC_INSTALL_DIR = User/GNUstep/
112
113gnustep-make_TEXI_FILES = \
114gnustep-make.texi
115gnustep-make_DOC_INSTALL_DIR = Developer/Make/Manual/
116
117gnustep-faq_TEXI_FILES = \
118gnustep-faq.texi \
119version.texi
120gnustep-faq_DOC_INSTALL_DIR = User/GNUstep/
121
122gnustep-userfaq_TEXI_FILES = \
123gnustep-userfaq.texi \
124version.texi
125gnustep-userfaq_DOC_INSTALL_DIR = User/GNUstep/
126
127gnustep-filesystem_TEXI_FILES = \
128gnustep-filesystem.texi
129gnustep-filesystem_DOC_INSTALL_DIR = User/GNUstep/
130
131gnustep-machines_TEXI_FILES = \
132gnustep-machines.texi
133gnustep-machines_DOC_INSTALL_DIR = User/GNUstep/
134
135gnustep-howto_TEXI_FILES = \
136gnustep-howto.texi \
137version.texi
138gnustep-howto_DOC_INSTALL_DIR = User/GNUstep/
139
140gnustep-internals_LATEX_FILES = \
141gnustep-internals.tex
142gnustep-internals_DOC_INSTALL_DIR = Developer/Make/Manual/Internals/
143
144INSTALL_TEXI_FILES = version.texi
145INSTALL_TEXT_MAIN = install.texi
146INSTALL_DOC_INSTALL_DIR = Developer/Make/ReleaseNotes/$(GNUSTEP_MAKE_VERSION)
147
148NEWS_TEXI_FILES = version.texi
149NEWS_TEXT_MAIN = news.texi
150NEWS_DOC_INSTALL_DIR = Developer/Make/ReleaseNotes/$(GNUSTEP_MAKE_VERSION)
151
152RELEASENOTES_TEXI_FILES = version.texi
153RELEASENOTES_TEXT_MAIN = releasenotes.texi
154RELEASENOTES_DOC_INSTALL_DIR = Developer/Make/ReleaseNotes
155
156README_TEXI_FILES = version.texi
157README_TEXT_MAIN = readme.texi
158README_DOC_INSTALL_DIR = Developer/Make/ReleaseNotes/$(GNUSTEP_MAKE_VERSION)
159
160ANNOUNCE_TEXI_FILES = version.texi
161ANNOUNCE_TEXT_MAIN = announce.texi
162ANNOUNCE_DOC_INSTALL_DIR = Developer/Make/ReleaseNotes/$(GNUSTEP_MAKE_VERSION)
163
164# The manpages are now installed when gnustep-make itself is installed.
165
166include $(GNUSTEP_MAKEFILES)/documentation.make
167
168include ../Version
169
170# Typing 'make regenerate' should build all, then install the files
171# top-level.  This is mostly for making gnustep-make releases.
172regenerate: all
173	mv -f $(TOP_DOC_FILES) ..
174
175# Generate the version.texi file from the Version of gnustep-make.
176version.texi: ../Version
177	rm -f version.texi
178	echo '@set GNUSTEP-MAKE-VERSION' $(GNUSTEP_MAKE_VERSION) \
179	 > version.texi
180
181after-install:: $(GNUSTEP_DOC)/Developer/Make/Manual $(GNUSTEP_DOC)/User/GNUstep
182	$(INSTALL_DATA) DESIGN $(GNUSTEP_DOC)/Developer/Make/Manual
183	for file in $(README_FILES); do \
184	  $(INSTALL_DATA) $$file $(GNUSTEP_DOC)/User/GNUstep/$$file; \
185	done
186
187#  Uninstall manually man pages
188after-uninstall::
189	rm -f $(GNUSTEP_DOC)/Developer/Make/Manual/DESIGN
190
191after-clean::
192	rm -rf tmp-build tmp-installation
193
194after-distclean::
195	rm -f version.texi
196
197endif
198