# Copyright (C) 2000-2002 Laurynas Biveinis # Beware - source distribution creation does not work yet after # integration of KITE & pakke. SHELL := /bin/sh # # Let the Autoconf replace common variables # CPPFLAGS := @CPPFLAGS@ CXX := @CXX@ CXXCPP := @CXXCPP@ CXXFLAGS := @CXXFLAGS@ DEFS := @DEFS@ DPMI := @DPMI@ EXE2COFF := @EXE2COFF@ EXEEXT := @EXEEXT@ MAKEINFO := @MAKEINFO@ TEXI2DVI := texi2dvi DVIPS := dvips LDFLAGS := @LDFLAGS@ LIBS := @LIBS@ PMODSTUB := @PMODSTUB@ prefix := @prefix@ srcdir := @srcdir@ UNZIP := @UNZIP@ UNZIPSFX := @UNZIPSFX@ VPATH := @srcdir@ ZIP := @ZIP@ # Look for texinfo docs in pakke doc directory too. # # TODO: (rdawe) Laurynas would prefer to use the VPATH mechanism. For now # just use a relative path. MAKEINFO_FLAGS := -I ../doc TEXI2DVI_FLAGS := -I ../doc --clean # Subdirs to get additional Makefile fragments from. SUBDIRS := include doc src # Makefile fragments in subdirs will add to following variables SOURCES := TXIS := # Include those fragments include $(patsubst %, %/makefile.inc, $(SUBDIRS)) # Determine object files OBJS := $(patsubst %.cc, %.o, $(filter %.cc, $(SOURCES))) # Determine dependency files DEPS := $(patsubst %.cc, %.d, $(filter %.cc, $(SOURCES))) # Determine documentation output files INFOS := $(patsubst %.txi, %.inf, $(filter %.txi, $(TXIS))) TXTS := $(patsubst %.txi, %.txt, $(filter %.txi, $(TXIS))) DVIS := $(patsubst %.txi, %.dvi, $(filter %.txi, $(TXIS))) PS := $(patsubst %.txi, %.ps, $(filter %.txi, $(TXIS))) # Main KITE program filename PROG := kite$(EXEEXT) # Short name for package (change for each release), max 7 chars. SNAME := kite05 # Source distribution package name SZIP := $(SNAME)s.zip # Binary distribution base name BZIP := install$(EXEEXT) # Path to source manifest file SMFT := $(srcdir)/../../manifest/$(SNAME)s.mft # (FIXME) # Default documentation output formats DOCS := $(INFOS) $(TXTS) WFLAGS := -W -Wall CXXFLAGS += $(WFLAGS) # Available phony targets for user: # `all' to make KITE # `doc' to make KITE documentation in all formats # `clean' to delete object and executable files # `distclean' to delete object, executable and configure-generated files # `nukeclean' to delete object, executable, configure-generated files and # generated distribution archives. # `sourcedist' to create source distribution # `bindist' to create binary distribution .PHONY : all bindist checkbintools checkzip clean distclean nukeclean \ sourcedist all : $(PROG) $(DOCS) doc : $(DOCS) $(DVIS) $(PS) bindist : $(BZIP) sourcedist : $(SZIP) clean : rm -f $(OBJS) $(PROG) $(DEPS) $(INFOS) $(TXTS) $(DVIS) $(PS) distclean : clean rm -f config.cache config.h config.log config.status Makefile stamp-h nukeclean : distclean rm -f $(SMFT) ../../$(SZIP) $(BZIP) # FIXME # Create manifest file for source distribution # Thanks to Rich for this piece $(SMFT) : # FIXME set -e; \ touch $(SMFT); \ cd $(srcdir)/../..; \ find . ! -type d | sed -e 's/^\.\/\(.*\)/\1/g' | sort \ > ./manifest/$(SNAME)s.mft $(SZIP) : distclean $(SMFT) set -e; \ cd $(srcdir)/../..; \ $(ZIP) -9 $@ @./manifest/$(SNAME)s.mft; \ cd $(srcdir); \ mv $(srcdir)/../../$(SZIP) $(srcdir)/$(SZIP) SFXSTUB := $(patsubst %.exe, %, $(UNZIPSFX)) $(SFXSTUB) : $(EXE2COFF) $(UNZIPSFX) $(BZIP) : $(PROG) $(SFXSTUB) set -e; \ $(ZIP) -9 -j $(BZIP).zip $(DPMI) $(PROG) $(UNZIP) @bindist.lst; \ cat $(UNZIPSFX) $(BZIP).zip > $(BZIP); \ $(ZIP) -A $(BZIP); \ cat $(PMODESTUB) $(BZIP) > $@; \ rm $(BZIP) $(BZIP).zip CPPFLAGS += $(DEFS) -I. -I./include CXXFLAGS += -fno-rtti -fno-exceptions # Calculate source dependencies %.d: %.cc set -e; \ $(CXXCPP) $(CPPFLAGS) -MM -MG $< | \ sed -e 's@ /[^ ]*@@g' -e 's@^\(.*\)\.o:@\1.d \1.o:@' > $@; # Include source dependencies -include $(OBJS:.o=.d) # Link the program $(PROG) : $(OBJS) $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) # Create documentation %.inf: %.txi $(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@ %.txt: %.txi $(MAKEINFO) --no-headers $(MAKEINFO_FLAGS) $< -o $@ # texi2dvi has no output filename output, so change into # the source directory, before building the DVI file. %.dvi: %.txi cd $(shell dirname $<); \ $(TEXI2DVI) $(TEXI2DVI_FLAGS) $(shell basename $<) %.ps: %.dvi $(DVIPS) -o $@ $< # Interact with Autoconf properly $(srcdir)/configure : configure.ac aclocal.m4 cd $(srcdir) && autoconf $(srcdir)/stamp-h.in : configure.ac aclocal.m4 echo timestamp > $(srcdir)/stamp-h.in $(srcdir)/config-h.in : stamp-h.in cd $(srcdir) && autoheader configure.ac > config-h.in config.h : stamp-h stamp-h : config-h.in config.status ./config.status Makefile : Makefile.in config.status ./config.status config.status: configure ./config.status --recheck