1### @configure_input@
2
3## Copyright (C) 2012-2021 Free Software Foundation, Inc.
4
5## This file is part of GNU Emacs.
6
7## GNU Emacs is free software: you can redistribute it and/or modify
8## it under the terms of the GNU General Public License as published by
9## the Free Software Foundation, either version 3 of the License, or
10## (at your option) any later version.
11##
12## GNU Emacs is distributed in the hope that it will be useful,
13## but WITHOUT ANY WARRANTY; without even the implied warranty of
14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15## GNU General Public License for more details.
16##
17## You should have received a copy of the GNU General Public License
18## along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
19
20### Commentary:
21
22### Code:
23SHELL = @SHELL@
24
25srcdir = @srcdir@
26abs_builddir = @abs_builddir@
27abs_top_builddir = @abs_top_builddir@
28EXEEXT = @EXEEXT@
29
30# abs_top_srcdir may contain ".."
31top_srcdir_abs = $(shell cd @top_srcdir@; pwd -P)
32
33MKDIR_P = @MKDIR_P@
34
35## Emacs.app.
36ns_appdir = @ns_appdir@
37## GNUstep: ns_appdir; macOS: ns_appdir/Contents/MacOS
38ns_appbindir = @ns_appbindir@
39## GNUstep/Emacs.base or Cocoa/Emacs.base.
40ns_appsrc = @ns_appsrc@
41## GNUstep: GNUstep/Emacs.base/Resources/Info-gnustep.plist
42## macOS: Cocoa/Emacs.base/Contents/Info.plist
43ns_check_file = @ns_appdir@/@ns_check_file@
44
45.PHONY: all
46
47all: ${ns_appdir} ${ns_appbindir}/Emacs ${ns_appbindir}/Emacs.pdmp
48
49${ns_check_file} ${ns_appdir}: ${srcdir}/${ns_appsrc} ${ns_appsrc}
50	rm -rf ${ns_appdir}
51	${MKDIR_P} ${ns_appdir}
52	( cd ${srcdir}/${ns_appsrc} ; tar cfh - . ) | \
53	  ( cd ${ns_appdir} ; umask 022; tar xf - )
54	[ "`cd ${srcdir} && /bin/pwd`" = "`/bin/pwd`" ] || \
55	  ( cd ${ns_appsrc} ; tar cfh - . ) | \
56	    ( cd ${ns_appdir} ; umask 022; tar xf - )
57	touch ${ns_appdir}
58
59## Don't create ns_appbindir via an order-only prerequisite, because
60## on GNUstep ns_appbindir and ns_bindir are the same, so
61## the rule for ns_appbindir would conflict with that for ns_appdir.
62${ns_appbindir}/Emacs: ${ns_appdir} ${ns_check_file} ../src/emacs${EXEEXT}
63	${MKDIR_P} ${ns_appbindir}
64	cp -f ../src/emacs${EXEEXT} $@
65
66${ns_appbindir}/Emacs.pdmp: ${ns_appdir} ${ns_check_file} ../src/emacs${EXEEXT}.pdmp
67	${MKDIR_P} ${ns_appbindir}
68	cp -f ../src/emacs${EXEEXT}.pdmp $@
69
70.PHONY: FORCE
71
72../src/emacs${EXEEXT}: FORCE
73	${MAKE} -C ../src $(notdir $@)
74
75# create a fake installation pointing back to the source tree
76# to run GUI Emacs in-place
77.PHONY: links
78
79links: ../src/emacs${EXEEXT}
80	for d in $(shell cd ${srcdir}/${ns_appsrc}; find . -type d); do ${MKDIR_P} ${ns_appdir}/$$d; done
81	for f in $(shell cd ${srcdir}/${ns_appsrc}; find . -type f); do ln -s $(shell cd ${srcdir}; pwd -P)/${ns_appsrc}/$$f ${ns_appdir}/$$f; done
82	for d in $(shell cd ${ns_appsrc}; find . -type d); do ${MKDIR_P} ${ns_appdir}/$$d; done
83	for f in $(shell cd ${ns_appsrc}; find . -type f); do rm -f ${ns_appdir}/$$f; ln -s $(shell cd ${ns_appsrc}; pwd -P)/$$f ${ns_appdir}/$$f; done
84	ln -s $(top_srcdir_abs)/lisp ${ns_appdir}/Contents/Resources
85	ln -s $(top_srcdir_abs)/info ${ns_appdir}/Contents/Resources
86	${MKDIR_P} ${ns_appbindir}
87	ln -s $(abs_top_builddir)/src/emacs${EXEEXT} ${ns_appbindir}/Emacs
88	ln -s $(abs_top_builddir)/src/emacs${EXEEXT}.pdmp ${ns_appbindir}/Emacs.pdmp
89	ln -s $(abs_top_builddir)/lib-src ${ns_appbindir}/bin
90	ln -s $(abs_top_builddir)/lib-src ${ns_appbindir}/libexec
91	${MKDIR_P} ${ns_appdir}/Contents/Resources/etc
92	for f in $(shell cd $(top_srcdir_abs)/etc; ls); do ln -s $(top_srcdir_abs)/etc/$$f ${ns_appdir}/Contents/Resources/etc; done
93	ln -s $(abs_top_builddir)/etc/DOC ${ns_appdir}/Contents/Resources/etc
94	@echo if the next find prints something, the installation failed
95	find ${ns_appdir} -exec test \! -e {} \; -ls
96
97.PHONY: clean distclean bootstrap-clean maintainer-clean
98
99clean:
100	rm -rf ${ns_appdir}
101
102distclean: clean
103	rm -f Makefile
104	rm -f GNUstep/Emacs.base/Resources/Info-gnustep.plist \
105	  GNUstep/Emacs.base/Resources/Emacs.desktop \
106	  Cocoa/Emacs.base/Contents/Info.plist \
107	  Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings
108
109bootstrap-clean maintainer-clean: distclean
110
111### Makefile.in ends here
112