Source

xemacs-packages / XEmacs.rules

Full commit
# Configuration constants for building XEmacs packages
# Copyright (C) 1997 Free Software Foundation Inc.

# This file is part of XEmacs.

# XEmacs is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version.

# XEmacs is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.

# You should have received a copy of the GNU General Public License
# along with XEmacs; see the file COPYING.  If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

# Requires XEmacs 21.0-beta19 or greater and GNU Make 3.78 or greater.

XEMACS_PACKAGES_BASE := $(shell while [ ! -f XEmacs.rules ]; do \
                                    cd ..;	\
                                done;		\
                                pwd)

# Make this the first target
bytecompile:: all

include ${XEMACS_PACKAGES_BASE}/Local.rules.mk
-include ${XEMACS_PACKAGES_BASE}/Local.rules

# Ensure vanilla locale when building
override LANG := C

# APA: XEmacs native NT currently (2000-06-23) has shortcomings we
# need to temporarily work around.
XEMACS_NATIVE_NT = \
$(shell $(XEMACS) $(VANILLA) -batch \
-eval "(princ (eq system-type 'windows-nt))")

# Only in rare cases will you need to override this
ifeq ($(AUTOLOAD_PATH),)
AUTOLOAD_PATH = .
endif

# Override or add to this in the package Makefile if necessary
GENERATED = $(AUTOLOAD_PATH)/auto-autoloads.elc

# SOURCE_FILES_TO_COPY = *.el*
SOURCE_FILES_TO_COPY = $(ELCS) $(ELCS:.elc=.el) \
	$(MULE_ELCS) $(MULE_ELCS:.elc=.el) \
	$(GENERATED) $(GENERATED:.elc=.el) $(AUTOLOAD_PATH)/_pkg.el

# Non configurable portion follows

MANIFEST = pkginfo/MANIFEST.$(PACKAGE)
# This might be a sublevel PWD; that is intentional.  Use
# ${XEMACS_PACKAGES_BASE} for the toplevel directory.
PWD      := $(shell pwd)

.SUFFIXES:
.SUFFIXES: .info .texi .dvi .elc .el

%.info: %.texi
	$(MAKEINFO) $(MAKEINFO_FLAGS) -o $@ $<

# APA: XEmacs native NT currently (2000-06-23) has shortcomings we
# need to temporarily work around.
ifeq ($(XEMACS_NATIVE_NT),t)
# APA: Convert UNIX-path (containing output of `pwd') to windows-path,
# so that XEmacs native NT can handle it.
PACKAGE_COMPILE = \
"$(shell cygpath --windows $(XEMACS_PACKAGES_BASE)/package-compile.el)"
else
PACKAGE_COMPILE = $(XEMACS_PACKAGES_BASE)/package-compile.el
endif

%.elc: %.el
	$(XEMACS) -no-autoloads -batch $(PRELOADS) -l $(PACKAGE_COMPILE) -- $(REQUIRES) -- $<

all:: $(AUTOLOAD_PATH)/_pkg.el

dist:: srckit binkit package-info

clean::
	rm -f $(ELCS) $(PACKAGE).info* $(AUTOLOAD_PATH)/auto-autoloads.elc \
		$(AUTOLOAD_PATH)/custom-load.elc

mostlyclean: clean

extraclean: clean

distclean: extraclean
	rm -f core *~ $(AUTOLOAD_PATH)/auto-autoloads.el \
		$(AUTOLOAD_PATH)/custom-load.el package-info \
		$(AUTOLOAD_PATH)/_pkg.el

# APA: XEmacs native NT currently (2000-06-23) has shortcomings we
# need to temporarily work around.
ifeq ($(XEMACS_NATIVE_NT),t)
# APA: XEmacs native NT currently needs this quoting of
# command-line-rguments.
AUTOLOAD_PACKAGE_NAME = (setq autoload-package-name \\\"$(PACKAGE)\\\")
else
AUTOLOAD_PACKAGE_NAME = (setq autoload-package-name \"$(PACKAGE)\")
endif

$(AUTOLOAD_PATH)/auto-autoloads.el : $(ELCS:.elc=.el) $(AUTOLOAD_PATH)/_pkg.el
	$(XEMACS) $(VANILLA) -batch \
		-eval "$(AUTOLOAD_PACKAGE_NAME)" \
		-l autoload -f batch-update-directory $(AUTOLOAD_PATH)
	@rm -f $(AUTOLOAD_PATH)/auto-autoloads.el~

$(AUTOLOAD_PATH)/custom-load.el : $(ELCS:.elc=.el)
	$(XEMACS) $(VANILLA) -batch -l cus-dep \
		-f Custom-make-dependencies $(AUTOLOAD_PATH)

pkg_tar = $(STAGING)/$(PACKAGE)-$(VERSION)-pkg.tar

# APA: XEmacs native NT currently (2000-06-23) has shortcomings we
# need to temporarily work around.
ifeq ($(XEMACS_NATIVE_NT),t)
# APA: Convert UNIX-path (containing output of `pwd') to windows-path,
# so that XEmacs native NT can handle it.
PKG_TAR_GZ = "$(shell cygpath --windows $(pkg_tar)).gz"
PACKAGE_INFO = "$(shell cygpath --windows $(STAGING)/package-index)"
else
PKG_TAR_GZ = $(pkg_tar).gz
PACKAGE_INFO = $(STAGING)/package-index
endif

# Make the $(pkg_tar).gz first, then the $(pkg_tar).bz2
package-info : package-info.in Makefile $(AUTOLOAD_PATH)/_pkg.el \
		$(pkg_tar).gz $(pkg_tar).bz2
	$(XEMACS) $(VANILLA) -batch \
		-l package-info.el -f batch-update-package-info \
		'$(VERSION)' $(PKG_TAR_GZ) \
		'$(REQUIRES)' \
		'$(AUTHOR_VERSION)' '$(MAINTAINER)' '$(CATEGORY)'
	$(XEMACS) $(VANILLA) -batch \
		-l ../../hack-package-index.el -f batch-hack-package-index \
			$(PACKAGE) package-info $(PACKAGE_INFO)

ifeq ($(BUILD_TARS),t)
$(pkg_tar): $(STAGING)/$(MANIFEST)
	@(cd $(STAGING);			\
	   rm -f $(pkg_tar)*)

	(cd $(STAGING);				\
	  $(TAR) $(EXCLUDES) -cf $(pkg_tar)	\
		`cat $(MANIFEST)`)


$(pkg_tar).gz: $(pkg_tar)
ifneq ($(BZIP2),) # need to leave behind the .tar for bzip2 to find.
	(cd $(STAGING);				\
	  gzip -cv9 $(pkg_tar) > $(pkg_tar).gz;)
else # BZIP2 is ''
	(cd $(STAGING);				\
	  gzip -v9 $(pkg_tar);)
endif

ifneq ($(BZIP2),)
$(pkg_tar).bz2: $(pkg_tar)
	(cd $(STAGING);				\
	  $(BZIP2) -v9 $(pkg_tar);)
else # Don't build a .tar.bz2
$(pkg_tar).bz2:

.PHONY: $(pkg_tar).bz2
endif # BZIP2 ?

else # when BUILD_TARS  is ''
# Touch the file so the package-index can be generated
$(pkg_tar) $(pkg_tar).gz $(pkg_tar).bz2 :
	touch $@
endif # BUILD_TARS ?


$(AUTOLOAD_PATH)/_pkg.el: Makefile
	@echo Creating $(AUTOLOAD_PATH)/_pkg.el
	@echo ";;;###autoload" > $(AUTOLOAD_PATH)/_pkg.el
	@echo "(package-provide '$(PACKAGE)" >> $(AUTOLOAD_PATH)/_pkg.el
	@echo "		 :version $(VERSION)" >> $(AUTOLOAD_PATH)/_pkg.el
	@echo "		 :type '$(PKG_TYPE))" >> $(AUTOLOAD_PATH)/_pkg.el

.PHONY: srckit-std
.PHONY: binkit-sourceonly binkit-sourceinfo binkit-sourcedata binkit-sourcedatainfo
.PHONY: bindist install autoloads

bindist: binkit package-info

install: binkit

autoloads: $(AUTOLOAD_PATH)/auto-autoloads.el

src_tar = $(STAGING)/$(PACKAGE)-$(VERSION)-src.tar

srckit-std: distclean
	if [ ! -d $(STAGING) ]; then mkdir -p $(STAGING); fi

	(cd ../..;				\
	  rm -f $(src_tar)*;			\
	  $(TAR) $(EXCLUDES) -cf $(src_tar) $(CATEGORY)/$(PACKAGE))

	gzip -cv9 $(src_tar) > $(src_tar).gz

ifneq ($(BZIP2),)
	$(BZIP2) -v9 $(src_tar);
endif 
	rm -f $(src_tar)


binkit-common: all
	(if test -d $(STAGING); then		\
		cd $(STAGING);			\
		if test -f $(MANIFEST); then	\
			rm -rf `cat $(MANIFEST)`; \
		fi;				\
	fi;)
#ifneq ($(ELCS),)
	@-mkdir -p $(STAGING)/lisp/$(PACKAGE)
#endif
ifneq ($(ELCS_1),)
	@-mkdir -p $(STAGING)/lisp/$(ELCS_1_DEST)
endif
ifneq ($(INFO_FILES),)
	@-mkdir -p $(STAGING)/info
	@-mkdir -p $(STAGING)/man/$(PACKAGE)
endif
ifneq ($(DATA_FILES),)
	@-mkdir -p $(STAGING)/etc/$(DATA_DEST)
endif
ifneq ($(DATA_1_FILES),)
	@-mkdir -p $(STAGING)/etc/$(DATA_1_DEST)
endif
ifneq ($(DATA_2_FILES),)
	@-mkdir -p $(STAGING)/etc/$(DATA_2_DEST)
endif
ifneq ($(DATA_3_FILES),)
	@-mkdir -p $(STAGING)/etc/$(DATA_3_DEST)
endif
ifneq ($(DATA_4_FILES),)
	@-mkdir -p $(STAGING)/etc/$(DATA_4_DEST)
endif
ifneq ($(DATA_5_FILES),)
	@-mkdir -p $(STAGING)/etc/$(DATA_5_DEST)
endif
ifneq ($(DATA_6_FILES),)
	@-mkdir -p $(STAGING)/etc/$(DATA_6_DEST)
endif
ifneq ($(DATA_7_FILES),)
	@-mkdir -p $(STAGING)/etc/$(DATA_7_DEST)
endif
ifneq ($(DATA_8_FILES),)
	@-mkdir -p $(STAGING)/etc/$(DATA_8_DEST)
endif
ifneq ($(LIBSRC_FILES),)
	@-mkdir -p $(STAGING)/lib-src
endif
	@-mkdir -p $(STAGING)/pkginfo
ifneq ($(ELCS),)
	$(RCOPY) $(addprefix $(PWD)/, ChangeLog $(SOURCE_FILES_TO_COPY) $(EXTRA_SOURCES)) \
	  $(STAGING)/lisp/$(PACKAGE)
endif
ifneq ($(ELCS_1),)
	$(RCOPY) $(addprefix $(PWD)/, $(ELCS_1_FILES)) $(STAGING)/lisp/$(ELCS_1_DEST)
endif
ifneq ($(INFO_FILES),)
	$(RCOPY) $(addprefix $(PWD)/, $(INFO_FILES)) $(STAGING)/info
	$(RCOPY) $(addprefix $(PWD)/, $(TEXI_FILES)) $(STAGING)/man/$(PACKAGE)
endif
ifneq ($(DATA_FILES),)
	$(RCOPY) $(addprefix $(PWD)/, $(DATA_FILES)) $(STAGING)/etc/$(DATA_DEST)
endif
ifneq ($(DATA_1_FILES),)
	$(RCOPY) $(addprefix $(PWD)/, $(DATA_1_FILES)) $(STAGING)/etc/$(DATA_1_DEST)
endif
ifneq ($(DATA_2_FILES),)
	$(RCOPY) $(addprefix $(PWD)/, $(DATA_2_FILES)) $(STAGING)/etc/$(DATA_2_DEST)
endif
ifneq ($(DATA_3_FILES),)
	$(RCOPY) $(addprefix $(PWD)/, $(DATA_3_FILES)) $(STAGING)/etc/$(DATA_3_DEST)
endif
ifneq ($(DATA_4_FILES),)
	$(RCOPY) $(addprefix $(PWD)/, $(DATA_4_FILES)) $(STAGING)/etc/$(DATA_4_DEST)
endif
ifneq ($(DATA_5_FILES),)
	$(RCOPY) $(addprefix $(PWD)/, $(DATA_5_FILES)) $(STAGING)/etc/$(DATA_5_DEST)
endif
ifneq ($(DATA_6_FILES),)
	$(RCOPY) $(addprefix $(PWD)/, $(DATA_6_FILES)) $(STAGING)/etc/$(DATA_6_DEST)
endif
ifneq ($(DATA_7_FILES),)
	$(RCOPY) $(addprefix $(PWD)/, $(DATA_7_FILES)) $(STAGING)/etc/$(DATA_7_DEST)
endif
ifneq ($(DATA_8_FILES),)
	$(RCOPY) $(addprefix $(PWD)/, $(DATA_8_FILES)) $(STAGING)/etc/$(DATA_8_DEST)
endif
ifneq ($(LIBSRC_FILES),)
	$(RCOPY) $(addprefix $(PWD)/, $(LIBSRC_FILES)) $(STAGING)/lib-src
endif
	(cd $(STAGING); \
	ls -1 $(MANIFEST) > $(MANIFEST))
ifneq ($(ELCS),)
	@(cd $(STAGING); \
	ls -1 lisp/$(PACKAGE)/ChangeLog \
		$(patsubst %, lisp/$(PACKAGE)/%, $(notdir $(SOURCE_FILES_TO_COPY))) \
		$(patsubst %, lisp/$(PACKAGE)/%, $(notdir $(EXTRA_SOURCES))) \
		>> $(MANIFEST))
endif
ifneq ($(ELCS_1),)
	@(cd $(STAGING); \
	ls -1 $(patsubst %, lisp/$(ELCS_1_DEST)/%, $(notdir $(ELCS_1_FILES))) \
		>> $(MANIFEST))
endif
ifneq ($(INFO_FILES),)
	@(cd $(STAGING); \
	ls -1 man/$(PACKAGE)/* \
		$(patsubst %,info/%, $(notdir $(INFO_FILES))) >> $(MANIFEST))
endif
ifneq ($(DATA_FILES),)
	@(cd $(STAGING); \
	ls -1 $(patsubst %, etc/$(DATA_DEST)/%, $(notdir $(DATA_FILES))) \
		>> $(MANIFEST))
endif
ifneq ($(DATA_1_FILES),)
	@(cd $(STAGING); \
	ls -1 $(patsubst %, etc/$(DATA_1_DEST)/%, $(notdir $(DATA_1_FILES))) \
		>> $(MANIFEST))
endif
ifneq ($(DATA_2_FILES),)
	@(cd $(STAGING); \
	ls -1 $(patsubst %, etc/$(DATA_2_DEST)/%, $(notdir $(DATA_2_FILES))) \
		>> $(MANIFEST))
endif
ifneq ($(DATA_3_FILES),)
	@(cd $(STAGING); \
	ls -1 $(patsubst %, etc/$(DATA_3_DEST)/%, $(notdir $(DATA_3_FILES))) \
		>> $(MANIFEST))
endif
ifneq ($(DATA_4_FILES),)
	@(cd $(STAGING); \
	ls -1 $(patsubst %, etc/$(DATA_4_DEST)/%, $(notdir $(DATA_4_FILES))) \
		>> $(MANIFEST))
endif
ifneq ($(DATA_5_FILES),)
	@(cd $(STAGING); \
	ls -1 $(patsubst %, etc/$(DATA_5_DEST)/%, $(notdir $(DATA_5_FILES))) \
		>> $(MANIFEST))
endif
ifneq ($(DATA_6_FILES),)
	@(cd $(STAGING); \
	ls -1 $(patsubst %, etc/$(DATA_6_DEST)/%, $(notdir $(DATA_6_FILES))) \
		>> $(MANIFEST))
endif
ifneq ($(DATA_7_FILES),)
	@(cd $(STAGING); \
	ls -1 $(patsubst %, etc/$(DATA_7_DEST)/%, $(notdir $(DATA_7_FILES))) \
		>> $(MANIFEST))
endif
ifneq ($(DATA_8_FILES),)
	@(cd $(STAGING); \
	ls -1 $(patsubst %, etc/$(DATA_8_DEST)/%, $(notdir $(DATA_8_FILES))) \
		>> $(MANIFEST))
endif

ifneq ($(LIBSRC_FILES),)
	@(cd $(STAGING); \
	ls -1 $(patsubst %,lib-src/%, $(notdir $(LIBSRC_FILES))) >> $(MANIFEST))
endif


binkit-sourceonly: binkit-common

binkit-sourceinfo: binkit-common

binkit-sourcedata: binkit-common

binkit-sourcedatainfo: binkit-common

# Local Variables:
# mode: makefile
# End: