pjs/mstone/Makefile

247 строки
7.8 KiB
Makefile
Исходник Обычный вид История

2000-03-28 05:22:46 +04:00
# Makefile for mstone
# use gmake
2000-03-28 05:22:46 +04:00
# Builds each of the components and then packages everything
topsrcdir = .
2000-04-01 03:50:41 +04:00
CP := cp -p
2000-03-28 05:22:46 +04:00
ifndef INCLUDED_CONFIG_MK
include $(topsrcdir)/config/config.mk
endif
2000-03-28 05:22:46 +04:00
# dynamically find the optional directories names
LIBGD_DIR = $(wildcard gd?.*)
GNUPLOT_DIR = $(wildcard gnuplot-?.*)
PERL_DIR = $(wildcard perl5.*)
# file that we package
2000-04-01 03:50:41 +04:00
GDFILES = gd.txt gd.html libgd.* gd.h demoin.gif gddemo giftogd webgif
GNUPLOTFILES = gnuplot Copyright gnuplot_x11 gnuplot.1 gnuplot.gih
2000-03-28 05:22:46 +04:00
VERSION = 4.3
2000-03-28 05:35:11 +04:00
TARBALL = mstone-$(VERSION)-$(NSARCH)$(OBJDIR_TAG).tar.gz
2000-03-29 06:07:05 +04:00
ZIPFILE = mstone-$(VERSION)-$(NSARCH)$(OBJDIR_TAG).zip
2000-03-30 03:22:57 +04:00
TARBALL_ALL = mstone-$(VERSION)-all$(OBJDIR_TAG).tar.gz
ZIPFILE_ALL = mstone-$(VERSION)-all$(OBJDIR_TAG).zip
2000-03-28 05:35:11 +04:00
NTFILES = mstone.bat process.bat setup.bat
2000-03-28 05:22:46 +04:00
all:: usage
usage::
@$(ECHO) "gmake [ release | rpackage | debug | dpackage ]"
@$(ECHO) " [ DIST=/m/dist/mailstone/1999xxxx dist ]"
2000-03-28 05:22:46 +04:00
@$(ECHO) " [ all_DBG | all_OPT ]"
@$(ECHO) "perl is" $(PERL_DIR) ". gd is" $(LIBGD_DIR) ". gnuplot is" $(GNUPLOT_DIR) "."
targets:: $(OBJDIR) mailclient
ifneq (,$(LIBGD_DIR))
targets:: libgd
endif
ifneq (,$(GNUPLOT_DIR))
targets:: gnuplot
endif
ifneq (,$(PERL_DIR))
targets:: perl
endif
2000-03-28 05:22:46 +04:00
$(OBJDIR):
-mkdir -p $(OBJDIR)
mailclient::
2000-03-28 05:22:46 +04:00
@$(ECHO) "\n===== [`date`] making OS_CONFIG=$(NSARCH) BUILD_VARIANT=$(BUILD_VARIANT)\n"
cd src; $(MAKE) BUILD_VARIANT=$(BUILD_VARIANT) OBJDIR=../$(OBJDIR) PKGDIR=../$(PKGDIR) all
2000-03-28 05:22:46 +04:00
# Use our top level makefiles to drive the component builds
2000-03-29 06:07:05 +04:00
libgd $(OBJDIR)/gd/libgd.a::
2000-03-28 05:22:46 +04:00
$(MAKE) -f gd.mk LIBGD_DIR=$(LIBGD_DIR) libgd
2000-03-29 06:07:05 +04:00
gnuplot $(OBJDIR)/gnuplot/gnuplot::
2000-03-28 05:22:46 +04:00
$(MAKE) -f gnuplot.mk LIBGD_DIR=$(LIBGD_DIR) GNUPLOT_DIR=$(GNUPLOT_DIR) gnuplot
2000-03-29 06:07:05 +04:00
perl $(OBJDIR)/perl/perl::
2000-04-01 03:50:41 +04:00
$(MAKE) -f perl.mk PERL_DIR=$(PERL_DIR) perl
# Create packaging binary directories
# Note: dont make gd or gnuplot here. For multi-OS, they are links
2000-03-28 05:22:46 +04:00
mkpkgdirs:: $(PKGDIR)/bin $(PKGDIR)/conf $(PKGDIR)/data $(PKGDIR)/doc
$(PKGDIR)/bin:
mkdir -p $(PKGDIR)/bin
$(PKGDIR)/conf:
mkdir -p $(PKGDIR)/conf
$(PKGDIR)/data:
mkdir -p $(PKGDIR)/data
$(PKGDIR)/doc:
mkdir -p $(PKGDIR)/doc
$(PKGDIR)/gd:
mkdir -p $(PKGDIR)/gd
$(PKGDIR)/gnuplot:
mkdir -p $(PKGDIR)/gnuplot
2000-03-29 06:07:05 +04:00
$(PKGDIR)/perl:
mkdir -p $(PKGDIR)/perl
# operating system independent share-files (at least for Unix)
pkg-share-files:: mkpkgdirs
@$(ECHO) "\n===== [`date`] making package share-files...\n"
2000-03-30 03:22:57 +04:00
$(CP) mstone process $(PKGDIR)
2000-03-29 06:07:05 +04:00
(cd $(PKGDIR); [ ! -f setup ] || rm -f setup; ln -s mstone setup)
(cd $(PKGDIR); [ ! -f cleanup ] || rm -f cleanup; ln -s mstone cleanup)
(cd $(PKGDIR); [ ! -f checktime ] || rm -f checktime; ln -s mstone checktime)
(cd $(PKGDIR); [ ! -f timesync ] || rm -f timesync; ln -s mstone timesync)
$(CP) nsarch bin/*.pl $(PKGDIR)/bin
2000-03-30 03:22:57 +04:00
$(CP) conf/*.wld conf/*.wld.in conf/*.html $(PKGDIR)/conf
$(CP) data/*.msg $(PKGDIR)/data
2000-03-28 05:22:46 +04:00
$(CP) doc/*.html doc/*.gif $(PKGDIR)/doc
$(CP) INSTALL $(PKGDIR)
$(CP) README $(PKGDIR)
$(CP) ChangeLog $(PKGDIR)
$(CP) LICENSE $(PKGDIR)
# split out OS specific file so that combined packaging possible (set PKGDIR)
2000-03-28 05:22:46 +04:00
pkg-arch-files-gd:: $(PKGDIR)/gd $(OBJDIR)/gd/libgd.a
$(CP) $(addprefix $(OBJDIR)/gd/, $(GDFILES)) $(PKGDIR)/gd
-$(STRIP) $(PKGDIR)/gd/webgif $(PKGDIR)/gd/giftogd $(PKGDIR)/gd/gddemo
pkg-arch-files-gnuplot:: $(PKGDIR)/gnuplot $(OBJDIR)/gnuplot/gnuplot
$(CP) $(addprefix $(OBJDIR)/gnuplot/, $(GNUPLOTFILES)) $(PKGDIR)/gnuplot
-$(STRIP) $(PKGDIR)/gnuplot/gnuplot $(PKGDIR)/gnuplot/gnuplot_x11
ifneq (,$(LIBGD_DIR))
pkg-arch-files:: pkg-arch-files-gd
endif
2000-03-28 05:22:46 +04:00
ifneq (,$(GNUPLOT_DIR))
pkg-arch-files:: pkg-arch-files-gnuplot
endif
pkg-arch-files:: $(PKGDIR)/bin $(OBJDIR)/mailclient
2000-04-01 03:50:41 +04:00
@$(ECHO) "\n===== [`date`] making package arch-files...\n"
2000-03-28 05:22:46 +04:00
$(CP) $(OBJDIR)/mailclient $(PKGDIR)/bin
-$(STRIP) $(PKGDIR)/bin/mailclient
2000-03-29 06:07:05 +04:00
pkg-perl-files:: $(PKGDIR)/bin $(OBJDIR)/perl/perl
@$(ECHO) "\n===== [`date`] making package perl-files...\n"
2000-04-01 03:50:41 +04:00
$(MAKE) -f perl.mk PERL_DIR=$(PERL_DIR) \
2000-03-29 06:07:05 +04:00
BUILD_VARIANT=$(BUILD_VARIANT) \
OBJDIR=$(OBJDIR) PKGDIR=$(PKGDIR) package-perl
find $(PKGDIR)/perl/lib -name .packlist -exec rm {} \; -print
-$(STRIP) $(PKGDIR)/perl/bin/perl
-$(STRIP) $(PKGDIR)/perl/bin/a2p
2000-03-29 06:07:05 +04:00
# for combined packaging, this should not be part of pkg-arch-files
# perl is handled seperately do to its size
2000-03-28 05:22:46 +04:00
ifneq (,$(PERL_DIR))
pkg:: pkg-perl-files
endif
2000-04-01 03:50:41 +04:00
pkg:: targets pkg-share-files pkg-arch-files
tarball: build/$(TARBALL)
2000-03-28 05:22:46 +04:00
2000-04-01 03:50:41 +04:00
build/$(TARBALL):
@$(ECHO) "\n===== [`date`] making os tar file...\n"
2000-03-28 05:22:46 +04:00
-rm -f build/$(TARBALL)
2000-04-01 03:50:41 +04:00
cd $(dir $(PKGDIR)) && tar cf - . | gzip > ../../$(TARBALL)
zipfile: build/$(ZIPFILE)
build/$(ZIPFILE):
@$(ECHO) "\n===== [`date`] making os zip file...\n"
-rm -f build/$(ZIPFILE)
cd $(dir $(PKGDIR)) && zip -r -q ../../$(ZIPFILE) .
2000-03-28 05:22:46 +04:00
########################################################################
# Generate a combined build for every Unix OS that is already packaged
# NT has to be done seperately because it has different file names
# We have to nuke some old parts, because permissions wont allow overwrites
# Finally, dont ship perl development headers and libraries
all_DBG all_OPT::
2000-03-29 06:07:05 +04:00
@$(ECHO) "===== [`date`] unified packaging for $@..."
2000-04-01 03:50:41 +04:00
$(MAKE) NSARCH=$@ OBJDIR_TAG='' \
PKGDIR=$(topsrcdir)/build/package/$@.OBJ/mstone pkg-share-files
./ospkg.sh $@.OBJ \
$(notdir $(shell ls -d build/package/[A-Z]*$(subst all,,$@.OBJ)))
2000-03-28 05:35:11 +04:00
[ -d $(topsrcdir)/build/package/$@.OBJ/mstone/bin/WINNT4.0 ] \
&& cp -p $(NTFILES) $(topsrcdir)/build/package/$@.OBJ/mstone; :
-rm -f ./build/mstone-$(VERSION)-$@.tar.gz
2000-04-01 03:50:41 +04:00
cd ./build/package/$@.OBJ \
&& tar cf - . | gzip > ../../mstone-$(VERSION)-$@.tar.gz
2000-03-29 06:07:05 +04:00
-rm -f ./build/mstone-$(VERSION)-$@.zip
2000-04-01 03:50:41 +04:00
cd ./build/package/$@.OBJ \
&& zip -r -q ../../mstone-$(VERSION)-$@.zip .
2000-03-28 05:22:46 +04:00
########################################################################
2000-03-29 06:07:05 +04:00
# Copy all the packaged trees to the distribution site
# Copy in the unified tarball and zip file
# Link mstone to mailstone for Netscape back compatibility
# Re-map short Linux name to standard Netscape convention
dist::
@[ "$(DIST)" != "" ] || ($(MAKE) usage && /bin/false)
@[ ! -d "$(DIST)" ] || ($(ECHO) "Error: $(DIST) already exists" && \
$(MAKE) usage && /bin/false)
mkdir -p $(DIST)
2000-04-01 03:50:41 +04:00
cp -p build/mstone-$(VERSION)-all_*.*[a-z] $(DIST)/
2000-03-29 06:07:05 +04:00
(cd build/package; tar cf - *.OBJ) | (cd $(DIST); tar xf - )
for l in $(DIST)/*_???.OBJ ; do \
(cd $$l; ln -s mstone mailstone); done
cd $(DIST); for l in Linux*_???.OBJ ; do \
nn=`echo $$l | sed -e 's/_OPT/_glibc_PTH_OPT/' | sed -e 's/_DBG/_glibc_PTH_DBG/'`; \
ln -s $$l $$nn; done
2000-04-01 03:50:41 +04:00
# since the default is release mode, this can just work off a dependency
release:: targets
#release::
# @$(ECHO) "\n===== [`date`] making release build..."
# $(MAKE) BUILD_VARIANT=release OBJDIR_TAG=_OPT targets
@$(ECHO) "\n===== [`date`] making release build done."
rpackage:: release pkg #tarball zipfile
#rpackage:: release
# @$(ECHO) "\n===== [`date`] making release package..."
# $(MAKE) BUILD_VARIANT=release OBJDIR_TAG=_OPT pkg tarball zipfile
@$(ECHO) "\n===== [`date`] making release package done."
# since the default is release mode, start a make with the right mode
debug::
@$(ECHO) "\n===== [`date`] making debug build..."
$(MAKE) BUILD_VARIANT=debug OBJDIR_TAG=_DBG targets
@$(ECHO) "\n===== [`date`] making debug build done."
# We dont usually bother to tar up a debug build
dpackage:: debug
@$(ECHO) "\n===== [`date`] making debug package..."
$(MAKE) BUILD_VARIANT=debug OBJDIR_TAG=_DBG pkg
@$(ECHO) "\n===== [`date`] making debug package done."
# These are old and may be broken
cleanvariant::
2000-03-28 05:22:46 +04:00
(cd src; $(MAKE) OBJDIR=../$(OBJDIR) clean)
rm -rf $(PKGDIR)
clean::
$(MAKE) BUILD_VARIANT=release OBJDIR_TAG=_OPT cleanvariant
$(MAKE) BUILD_VARIANT=debug OBJDIR_TAG=_DBG cleanvariant
distcleanvariant::
2000-03-28 05:22:46 +04:00
(cd src; $(MAKE) OBJDIR=../$(OBJDIR) distclean)
rm -rf $(OBJDIR) $(PKGDIR)
distclean:: clean
$(MAKE) BUILD_VARIANT=release OBJDIR_TAG=_OPT distcleanvariant
$(MAKE) BUILD_VARIANT=debug OBJDIR_TAG=_DBG distcleanvariant