home *** CD-ROM | disk | FTP | other *** search
Makefile | 1994-08-16 | 5.7 KB | 198 lines |
- #
- # Makefile for the productized installation of Emacs on a NeXT.
- #
- # Lennart Lovstrand, Mon Dec 7 18:49:48 1992
- #
- # Note: The emacs man page is no longer installed by the emacs
- # project. If an updated man page is released by FSF, it should
- # be given to the manpages project.
- #
-
- SYMROOT=.
- OBJROOT=.
-
- BINDIR= /usr/bin
- LIBDIR= /usr/lib/emacs
- # MANDIR= /usr/man/man1
- SRCDIR= /NextDeveloper/Source/emacs
-
- SFILE= s-mach2.h
- MFILE= m-next.h
-
- MAKEORIG=Makefile.orig
-
- DSTBINDIR=$(DSTROOT)$(BINDIR)
- DSTLIBDIR=$(DSTROOT)$(LIBDIR)
- # DSTMANDIR=$(DSTROOT)$(MANDIR)
- DSTSRCDIR=$(DSTROOT)/$(SRCDIR)
-
- DSTLCKDIR=$(DSTLIBDIR)/lock
- ETCFILES=COPYING DISTRIB DOC-* MAILINGLISTS NEWS TUTORIAL *.lines
-
- #
- # Standard Makefile targets
- #
-
- all: sanitycheck linksrc $(SYMROOT)/src/paths.h $(SYMROOT)/src/config.h
- @echo "# Building `basename \`pwd\``..."
- cd $(SYMROOT); make -f $(MAKEORIG) all
-
- install: $(DSTBINDIR) $(DSTLIBDIR) $(DSTLCKDIR) $(DSTSRCDIR) all
- cd $(SYMROOT); \
- install -c -m 755 -s -o root -g wheel src/xemacs $(DSTBINDIR)/emacs; \
- install -c -m 755 -s -o root -g wheel etc/etags $(DSTBINDIR)/etags
- # install -c -m 644 -o root -g wheel etc/emacs.1 $(DSTMANDIR)/emacs.1
- for d in info lisp; do \
- tar cf - $$d | (cd $(DSTLIBDIR); tar xf -); \
- done
- -rm -f $(DSTLIBDIR)/lisp/version.el
- cp $(SYMROOT)/lisp/version.el $(DSTLIBDIR)/lisp/version.el
- -mkdirs $(DSTLIBDIR)/etc
- cd $(SYMROOT)/etc; install -c $(ETCFILES) $(DSTLIBDIR)/etc
- find $(SYMROOT)/etc -type f -a ! -type l -print | \
- while read f; do \
- if file $$f | grep -s Mach-O; then \
- install -c -s $$f $(DSTLIBDIR)/etc; \
- fi; \
- done
- -rm -f $(DSTLIBDIR)/etc/test-distrib
- -chown -R root.wheel $(DSTLIBDIR)
- -chmod -R go-w $(DSTLIBDIR)/etc $(DSTLIBDIR)/info $(DSTLIBDIR)/lisp
- @if [ "$(SYMROOT)" != . ]; then \
- echo "# Removing .o files from $$(SYMROOT)..."; \
- find $(SYMROOT) -name \*.o -exec rm '{}' \;; \
- fi
- @echo "# Copying the source to $(DSTSRCDIR)..."; \
- tar cf - . | (cd $(DSTSRCDIR); tar xvfp -)
- @echo "# Removing crud files..."; \
- rm -f $(DSTSRCDIR)/SGS_ENV; \
- make -f $(MAKEORIG) clean LIBDIR=$(DSTLIBDIR)
-
- installhdrs:
-
- installsrc: $(SRCROOT)
- tar cf - . | (cd $(SRCROOT); tar xvfp -)
-
- clean:
- cd $(SYMROOT); make -f $(MAKEORIG) clean LIBDIR=$(DSTLIBDIR)
-
- #
- # Supporting Makefile targets
- #
-
- sanitycheck:
- @if [ -n "$(RC_ARCHS)" -a "$(RC_ARCHS)" != `arch` ]; then \
- echo -n "*** Sorry, Emacs can only be built natively;"; \
- echo " this version will be `arch` only"; \
- fi
- @if [ ! -f $(MAKEORIG) ]; then \
- echo -n "*** Oops: The original Makefile must be present as"; \
- echo " $(MAKEORIG)"; \
- false; \
- fi
- @for f in src/config.h-dist src/paths.h-dist; do \
- if [ ! -f $$f -a ! -f `basename $f -dist` ]; then \
- echo "*** Oops: Required file $$f is missing"; \
- false; \
- fi; \
- done
-
- linksrc: $(SYMROOT)
- @if [ $(SYMROOT) = . ]; then \
- if grep "^CPP" src/Makefile | grep -s traditional; then \
- true; \
- else \
- echo "*** Can't build in-place:"; \
- echo '*** Please either build emacs with SYMROOT != "." or add'; \
- echo '*** "-traditional" to the CPP command in src/Makefile.'; \
- false; \
- fi; \
- elif [ ! -f $(SYMROOT)/.linked ]; then \
- echo -n "# Linking source tree into $(SYMROOT)..."; \
- s=`pwd | sed 's=^/private=='`; \
- v=`vers_string -n`; \
- find . -print | sed 's=^./==' | (cd $(SYMROOT); \
- while read f; do \
- if [ -d $$s/$$f ]; then \
- echo -n " $$f"; \
- if [ ! -d $$f ]; then \
- mkdirs $$f; \
- fi; \
- else \
- if [ ! -f $$f ]; then \
- ln -s $$s/$$f $$f; \
- fi; \
- fi; \
- done; \
- echo ""; \
- echo "# Fixing up various cruft in the distribution:"; \
- if grep "^CPP" src/Makefile | grep -s traditional; then \
- true; \
- else \
- echo "# Adding -traditional to CPP in src/Makefile"; \
- rm -f src/Makefile; \
- sed '/^CPP/s/$$/ -traditional/' \
- $$s/src/Makefile >src/Makefile; \
- fi; \
- if grep -s "vers\.o" src/ymakefile; then \
- true; \
- else \
- echo "# Including an SGS version file"; \
- rm -f src/ymakefile; \
- sed '/^obj=/s/=/= vers.o/' \
- $$s/src/ymakefile >src/ymakefile; \
- vers_string -c emacs >src/vers.c; \
- fi; \
- if grep C_SWITCH_MACHINE src/m-next.h | grep -s -e "-O"; then \
- true; \
- else \
- echo "# Adding -O to C_SWITCH_MACHINE in src/m-next.h"; \
- rm -f src/m-next.h; \
- sed '/C_SWITCH_MACHINE/s/$$/ -O/' \
- $$s/src/m-next.h >src/m-next.h; \
- fi; \
- if grep CFLAGS etc/Makefile | grep -s -e "-O"; then \
- true; \
- else \
- echo "# Adding -O to CFLAGS in etc/Makefile"; \
- rm -f etc/Makefile; \
- sed '/CFLAGS/s/$$/ -O/' \
- $$s/etc/Makefile >etc/Makefile; \
- fi; \
- rm -f etc/DOC*; \
- echo "# Changing lisp/paths.el's definition of" \
- "manual-program [#33031]"; \
- rm -f lisp/paths.el; \
- sed "s/(eq system-type 'berkeley-unix)/(file-exists-p \"\\/usr\\/ucb\\/man\")/" \
- $$s/lisp/paths.el >lisp/paths.el; \
- echo "# Setting lisp/version.el's emacs-version to $$v"; \
- rm -f lisp/version.el; \
- sed "s/-version \"[0-9\.]*\"/-version \"$$v\"/" \
- $$s/lisp/version.el >lisp/version.el; \
- echo "# Disabling lisp/inc-vers.el"; \
- rm -f lisp/inc-vers.el; \
- echo "(kill-emacs)" >lisp/inc-vers.el); \
- fi; \
- touch $(SYMROOT)/.linked
-
- $(SYMROOT)/src/paths.h:
- @echo "# Creating a NeXT-based paths.h file..."
- sed 's=/usr/local/emacs=$(LIBDIR)=g' src/paths.h-dist >$@
-
- $(SYMROOT)/src/config.h:
- @echo "# Creating a NeXT-based config.h file..."
- sed -e 's/^#include "s-.*"/#include "$(SFILE)"/' \
- -e 's/^#include "m-.*"/#include "$(MFILE)"/' \
- src/config.h-dist >$@
-
- cleanlinks: $(SYMROOT)
- if [ "$(SYMROOT)" != "." ]; then \
- find $(SYMROOT) -type l -exec rm '{}' \;; \
- fi
-
- $(OBJROOT) $(SYMROOT) $(DSTROOT) $(SRCROOT) $(DSTBINDIR) $(DSTLIBDIR) $(DSTSRCDIR):
- mkdirs $@
-
- $(DSTLCKDIR):
- mkdirs -m 777 $@
-