Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 21. máj 2025

Súbor: [Platon] / platos / _templates / Rules.make (stiahnutie)

Revízia 1.35, Wed Aug 30 15:22:01 2006 UTC (18 years, 8 months ago) by rajo


Zmeny od 1.34: +10 -2 [lines]

make view with PREFIX

#
# Rules.make - make rules for diplomovka-text
#              This file is included by 'make' from Makefile
#
# Developed by Lubomir Host 'rajo' <rajo AT platon.sk>
# Copyright (c) 2003-2005 Platon SDG, http://platon.sk/
# Licensed under terms of GNU General Public License.
# All rights reserved.
#
# $Platon: platos/_templates/Rules.make,v 1.34 2006-08-14 10:01:20 nepto Exp $
#

ps__OUTPUT        = $(shell sed 's/\#.*$$//g;' ps__OUTPUT 2>/dev/null)
pdf_OUTPUT        = $(shell sed 's/\#.*$$//g;' pdf_OUTPUT 2>/dev/null) 
htm_OUTPUT        = $(shell sed 's/\#.*$$//g;' htm_OUTPUT 2>/dev/null) 
rtf_OUTPUT        = $(shell sed 's/\#.*$$//g;' rtf_OUTPUT 2>/dev/null) 

# Other programs configured automaticaly:
BUILD_STRUCT = $(TOP_DIR)/_scripts/build-struct
CREATE_DOC   = $(TOP_DIR)/_scripts/create-document

#
# Default programs (if not set in Makefiles)
# {{{
ifeq ($(strip $(TEX)),)
TEX            = csplain
endif
ifeq ($(strip $(PDFTEX)),)
PDFTEX         = pdfcsplain
endif
ifeq ($(strip $(LATEX)),)
#LATEX          = cslatex
LATEX          = latex
endif
ifeq ($(strip $(PDFLATEX)),)
#PDFLATEX       = pdfcslatex
PDFLATEX       = pdflatex
endif
ifeq ($(strip $(LATEX2HTML)),)
LATEX2HTML     = latex2html
endif
ifeq ($(strip $(LATEX2RTF)),)
LATEX2RTF     = latex2rtf
endif

ifeq ($(strip $(DVIPS)),)
DVIPS          = dvips
endif
ifeq ($(strip $(PS2PDF)),)
PS2PDF         = dvips
endif
ifeq ($(strip $(GV)),)
GV             = gv
endif
ifeq ($(strip $(GNUPLOT)),)
GNUPLOT        = gnuplot
endif
ifeq ($(strip $(CC)),)
CC             = gcc
endif
ifeq ($(strip $(TAR)),)
TAR            = tar
endif
ifeq ($(strip $(ZIP)),)
ZIP            = zip
endif

ifeq ($(strip $(ZIP_ENV)),)
ZIP_ENV        = -r9
endif
ifeq ($(strip $(GZIP_ENV)),)
GZIP_ENV       = --best
endif
ifeq ($(strip $(LATEX2HTML_ENV)),)
LATEX2HTML_ENV =
endif
ifeq ($(strip $(LATEX2RTF_ENV)),)
LATEX2RTF_ENV = -C latin2 -F
endif
# }}}

TEX_COMPILER             = $(LATEX)
TEX_COMPILER_BATCH       = $(LATEX) -interaction=batchmode
PDFTEX_COMPILER          = $(PDFLATEX)
PDFTEX_COMPILER_BATCH    = $(PDFLATEX) -interaction=batchmode
HTML_COMPILER            = $(LATEX2HTML) $(LATEX2HTML_ENV)
RTF_COMPILER             = $(LATEX2RTF) $(LATEX2RTF_ENV)

# TEX_COMPILER             = $(TEX)
# TEX_COMPILER_BATCH       = $(TEX) -interaction=batchmode
# PDFTEX_COMPILER          = $(PDFTEX)
# PDFTEX_COMPILER_BATCH    = $(PDFTEX) -interaction=batchmode

#
# Stylesheet macros
# {{{

ifeq ($(strip $(STYLESHEET)),)
STYLESHEET            = platonsdg
endif

ifeq ($(strip $(STYLESHEET_DIR)),)
STYLESHEET_DIR        = $(TOP_DIR)/_stylesheets
endif

ifeq ($(strip $(STYLESHEET_FILES)),)
STYLESHEET_FILES    = $(shell find $(STYLESHEET_DIR) -mindepth 1 -maxdepth 2 \! \( -name 'CVS' -o -name '.svn' -o -name '.*.sw?' -o -name template.tex \) -print | grep -v /CVS/ | grep -v .svn)
endif

# }}}

#
# Terminal colors definition
# {{{

RESET        = 
BOLD        = 
UNDERLINE    = 
BELL        = 
BLACK        = 
RED            = 
GREEN        = 
YELLOW        = 
BLUE        = 
MAGENTA        = 
CYAN        = 
WHITE        = 
# BOMB!!! Let's fun :-)
BOMB        = [?7h)0 


export RESET
export BOLD
export UNDERLINE
export BELL
export BLACK
export RED
export GREEN
export YELLOW
export BLUE
export MAGENTA
export CYAN
export WHITE
export BOMB

# }}}

DEPEND_all = Makefile \
             $(STYLESHEET_FILES) \
             $(IMAGES) \
             $(DEPEND)
export TOP_DIR
export DEPEND_all

ifneq ($(strip $(ps__OUTPUT)),)
export ps__OUTPUT
OUTPUT := $(ps__OUTPUT)
endif # ifneq ps__OUTPUT

ifneq ($(strip $(pdf_OUTPUT)),)
export pdf_OUTPUT
OUTPUT := $(OUTPUT) $(pdf_OUTPUT)
endif # ifneq pdf_OUTPUT

ifneq ($(strip $(htm_OUTPUT)),)
export htm_OUTPUT
OUTPUT := $(OUTPUT) $(htm_OUTPUT)
endif # ifneq htm_OUTPUT

ifneq ($(strip $(rtf_OUTPUT)),)
export rtf_OUTPUT
OUTPUT := $(OUTPUT) $(rtf_OUTPUT)
endif # ifneq rtf_OUTPUT

ifneq ($(strip $(OUTPUT)),)
export OUTPUT
endif # ifneq OUTPUT

ps__INPUT    = $(patsubst %.ps,%.tex,$(ps__OUTPUT))
pdf_INPUT    = $(patsubst %.pdf,%.tex,$(pdf_OUTPUT))
htm_INPUT    = $(patsubst %.html,%.tex,$(htm_OUTPUT))
rtf_INPUT    = $(patsubst %.rtf,%.tex,$(rtf_OUTPUT))
export ps__INPUT
export pdf_INPUT
export htm_INPUT
export rtf_INPUT

DVI_ps__OUTPUT    = $(patsubst %.ps,%.dvi,$(ps__OUTPUT))
DVI_pdf_OUTPUT    = $(patsubst %.pdf,%.dvi,$(pdf_OUTPUT))
DVI_OUTPUT        = $(DVI_ps__OUTPUT) $(DVI_pdf_OUTPUT)

ps__OUTPUT_first  = $(patsubst %,.first.%,$(ps__OUTPUT))
pdf_OUTPUT_first  = $(patsubst %,.first.%,$(pdf_OUTPUT))
htm_OUTPUT_first  = $(patsubst %,.first.%,$(htm_OUTPUT))
rtf_OUTPUT_first  = $(patsubst %,.first.%,$(rtf_OUTPUT))
OUTPUT_first      = $(ps__OUTPUT_first)

ps__OUTPUT_second = $(patsubst %,.second.%,$(ps__OUTPUT))
pdf_OUTPUT_second = $(patsubst %,.second.%,$(pdf_OUTPUT))
htm_OUTPUT_second = $(patsubst %,.second.%,$(htm_OUTPUT))
rtf_OUTPUT_second = $(patsubst %,.second.%,$(rtf_OUTPUT))
OUTPUT_second     = $(ps__OUTPUT_second)

ps__OUTPUT_third  = $(patsubst %,.third.%,$(ps__OUTPUT))
pdf_OUTPUT_third  = $(patsubst %,.third.%,$(pdf_OUTPUT))
htm_OUTPUT_third  = $(patsubst %,.third.%,$(htm_OUTPUT))
rtf_OUTPUT_third  = $(patsubst %,.third.%,$(rtf_OUTPUT))
OUTPUT_third      = $(ps__OUTPUT_third)

ifneq ($(strip $(APPEND_DIRNAME)),)
ifneq ($(strip $(PREFIX)),)
PREFIX            := $(PREFIX)-$(shell basename `pwd`)
else
PREFIX            := $(shell basename `pwd`)
endif # ifneq PREFIX
endif # ifneq APPEND_DIRNAME


ifneq ($(strip $(PREFIX)),)
prefix_ps__OUTPUT = $(patsubst %,$(PREFIX)-%,$(ps__OUTPUT))
prefix_pdf_OUTPUT = $(patsubst %,$(PREFIX)-%,$(pdf_OUTPUT))
prefix_htm_OUTPUT = $(patsubst %,$(PREFIX)-%,$(htm_OUTPUT))
prefix_rtf_OUTPUT = $(patsubst %,$(PREFIX)-%,$(rtf_OUTPUT))
endif # ifneq PREFIX

.SUFFIXES:

#
# Now create target `all'
#
# With variables $(ps__OUTPUT) and $(pdf_OUTPUT) you can customize,
# which type of output you will create.
# target all {{{
ifneq ($(strip $(ps__OUTPUT)),) # {{{
ifneq ($(strip $(PREFIX)),)
PS__TARGETS := ps-subdir ps-prefixed-output
else
PS__TARGETS := ps-subdir ps-prefixed-output
endif # ifdef PREFIX
endif # }}} ifdef ps__OUTPUT

ifneq ($(strip $(pdf_OUTPUT)),) # {{{
ifneq ($(strip $(PREFIX)),)
PDF_TARGETS := pdf-subdir pdf-prefixed-output
else
PDF_TARGETS := pdf-subdir pdf-prefixed-output
endif # ifdef PREFIX
endif # }}} ifdef pdf_OUTPUT

ifneq ($(strip $(htm_OUTPUT)),) # {{{
ifneq ($(strip $(PREFIX)),)
HTM_TARGETS := html-subdir html-prefixed-output
else
HTM_TARGETS := html-subdir html-prefixed-output
endif # ifdef PREFIX
endif # }}} ifdef htm_OUTPUT

ifneq ($(strip $(rtf_OUTPUT)),) # {{{
ifneq ($(strip $(PREFIX)),)
RTF_TARGETS := rtf-subdir rtf-prefixed-output
else
RTF_TARGETS := rtf-subdir rtf-prefixed-output
endif # ifdef PREFIX
endif # }}} ifdef rtf_OUTPUT

ifeq ($(strip $(ps__OUTPUT)$(pdf_OUTPUT)$(htm_OUTPUT)$(rtf_OUTPUT)),)
# if *_OUTPUT is empty, build target 'all-top' (print help, etc)
all-top::
# ... and don't do anything
ALL_TARGETS =
else
ALL_TARGETS = $(PS__TARGETS) $(PDF_TARGETS) $(HTM_TARGETS) $(RTF_TARGETS)
endif

ifneq ($(strip $(PREFIX)),)
all: $(ALL_TARGETS)
    @echo 'PREFIX = "$(PREFIX)"'
else
all: $(ALL_TARGETS)
endif # ifdef PREFIX

# }}} end of taget `all'


#
# Print usage message
# {{{
all-top::
    @echo "Usage:"
    @echo ""
    @echo "    make clean       - recursive clean, removes all unnecessary files"
    @echo "    make new         - creates new document"
    @echo "    make doc[uments] - build all documents"
    @echo "    make dist        - create tarball for distribution"
    @echo ""
# }}}

# Create new document with command 'make new'
new:
    $(CREATE_DOC)

# Create default files, if not exists:
# {{{
ps__OUTPUT:
    touch $@

pdf_OUTPUT:
    touch $@

htm_OUTPUT:
    touch $@
# }}}

ps-subdir:
    -@$(BUILD_STRUCT) "PostScript" LATEX "$(strip $(LATEX))" \
        && $(MAKE) TOP_DIR=$(TOP_DIR)/.. -C PostScript PostScript ; echo -e "$(BLUE)Building of $(MAGENTA)PostScript$(BLUE) done.$(RESET)"

pdf-subdir:
    -@$(BUILD_STRUCT) "PDF" PDFLATEX "$(strip $(PDFLATEX))" \
        && $(MAKE) TOP_DIR=$(TOP_DIR)/.. -C PDF PDF ; echo -e "$(BLUE)Building of $(MAGENTA)PDF$(BLUE) done.$(RESET)"

html-subdir:
    -@$(BUILD_STRUCT) "HTML" LATEX2HTML "$(strip $(LATEX2HTML))" \
        && $(MAKE) TOP_DIR=$(TOP_DIR)/.. -C HTML HTML ; echo -e "$(BLUE)Building of $(MAGENTA)HTML$(BLUE) done.$(RESET)"

rtf-subdir:
    -@$(BUILD_STRUCT) "RTF" LATEX2RTF "$(strip $(LATEX2RTF))" \
        && $(MAKE) TOP_DIR=$(TOP_DIR)/.. -C RTF RTF ; echo -e "$(BLUE)Building of $(MAGENTA)RTF$(BLUE) done.$(RESET)"


PostScript: $(ps__OUTPUT_first) $(ps__OUTPUT_second) $(ps__OUTPUT_third) $(DVI_ps__OUTPUT) $(ps__OUTPUT)

PDF: $(pdf_OUTPUT)

HTML: $(htm_OUTPUT)

RTF: $(rtf_OUTPUT)

ifneq ($(strip $(PREFIX)),) # prefixed directories {{{
ps-prefixed-output:
    @-for file in $(ps__OUTPUT); do \
        echo "ln -f 'PostScript/$$file' '$(PREFIX)-$$file'"; \
            ln -f "PostScript/$$file" "$(PREFIX)-$$file" \
                || cp -f "PostScript/$$file" "$(PREFIX)-$$file"; \
     done

pdf-prefixed-output:
    @-for file in $(pdf_OUTPUT); do \
        echo "ln -f 'PDF/$$file' '$(PREFIX)-$$file'"; \
            ln -f "PDF/$$file" "$(PREFIX)-$$file" \
                || cp -f "PDF/$$file" "$(PREFIX)-$$file"; \
     done

html-prefixed-output:
    @-for file in $(htm_OUTPUT); do \
        cssfile=$${file%.html}.css; \
        echo "ln -f 'HTML/$$file' '$(PREFIX)-$$file'"; \
            ln -f "HTML/$$file" "$(PREFIX)-$$file" \
                || cp -f "HTML/$$file" "$(PREFIX)-$$file"; \
        echo "ln -f 'HTML/$$cssfile' '$$cssfile'"; \
            ln -f "HTML/$$cssfile" "$$cssfile" \
                || cp -f "HTML/$$cssfile" "$$cssfile"; \
        echo "ln -s -f '$$cssfile' '$(PREFIX)-$$cssfile'"; \
            ln -s -f "$$cssfile" "$(PREFIX)-$$cssfile" \
                || cp -f "$$cssfile" "$(PREFIX)-$$cssfile"; \
     done

rtf-prefixed-output:
    @-for file in $(rtf_OUTPUT); do \
        echo "ln -f 'RTF/$$file' '$(PREFIX)-$$file'"; \
            ln -f "RTF/$$file" "$(PREFIX)-$$file" \
                || cp -f "RTF/$$file" "$(PREFIX)-$$file"; \
     done
else # }}} {{{
ps-prefixed-output:
    @-for file in $(ps__OUTPUT); do \
        echo "ln -f 'PostScript/$$file' '$$file'"; \
            ln -f "PostScript/$$file" "$$file" \
                || cp -f "PostScript/$$file" "$$file"; \
     done

pdf-prefixed-output:
    @-for file in $(pdf_OUTPUT); do \
        echo "ln -f 'PDF/$$file' '$$file'"; \
            ln -f "PDF/$$file" "$$file" \
                || cp -f "PDF/$$file" "$$file"; \
     done

html-prefixed-output:
    @-for file in $(htm_OUTPUT); do \
        cssfile=$${file%.html}.css; \
        echo "ln -f 'HTML/$$file' '$$file'"; \
            ln -f "HTML/$$file" "$$file" \
                || cp -f "HTML/$$file" "$$file"; \
        echo "ln -f 'HTML/$$cssfile' '$$cssfile'"; \
            ln -f "HTML/$$cssfile" "$$cssfile" \
                || cp -f "HTML/$$cssfile" "$$cssfile"; \
        echo "ln -s -f '$$cssfile' '$$cssfile'"; \
            ln -s -f "$$cssfile" "$$cssfile" \
                || cp -f "$$cssfile" "$$cssfile"; \
     done

rtf-prefixed-output:
    @-for file in $(rtf_OUTPUT); do \
        echo "ln -f 'RTF/$$file' '$$file'"; \
            ln -f "RTF/$$file" "$$file" \
                || cp -f "RTF/$$file" "$$file"; \
     done
endif # }}} ifdef PREFIX

%.ps: %.dvi $(ps__OUTPUT_first) $(ps__OUTPUT_second) $(ps__OUTPUT_third)
    $(DVIPS) -o $@ $<

%.pdf: $(pdf_OUTPUT_first) $(DEPEND_all) pdf_OUTPUT
    @file="`echo '$@'`"; \
    echo "$(PDFTEX_COMPILER) $${file%.pdf}.tex"; \
    $(PDFTEX_COMPILER) $${file%.pdf}.tex

%.html: $(htm_OUTPUT_first) $(DEPEND_all) htm_OUTPUT
    @file="`echo '$@'`"; \
    echo "$(HTML_COMPILER) $${file%.html}.tex"; \
    DOC_STYLESHEET="`awk -v FS='[{-]' '/\\usepackage.*-core}/ { print $$2; }' $${file%.html}.tex`"; \
    echo "Using stylesheet $$DOC_STYLESHEET"; \
    export HOME="$$DOC_STYLESHEET" ; \
    $(HTML_COMPILER) $${file%.html}.tex; \
    ln $${file%.html}/$${file%.html}.html; \
    cat $(STYLESHEET).css > $${file%.html}.css

%.rtf: $(rtf_OUTPUT_first) $(DEPEND_all) rtf_OUTPUT
    @file="`echo '$@'`"; \
    echo "$(RTF_COMPILER) $${file%.rtf}.tex"; \
    $(RTF_COMPILER) $${file%.rtf}.tex;


%.dvi: .third.%.ps

.third.%.ps: %.tex $(DEPEND_all) ps__OUTPUT .second.%.ps
    $(TEX_COMPILER) $< \
        && touch $@

.second.%.ps: .first.%.ps
    @file="`echo '$@' | sed 's/^.second.//g;'`"; \
    echo "$(TEX_COMPILER_BATCH) $${file%.ps}.tex"; \
    $(TEX_COMPILER_BATCH) $${file%.ps}.tex \
        && touch $@
    
.first.%.html: %.tex
    $(HTML_COMPILER) $< \
        && touch $@

.first.%.rtf: %.tex
    $(RTF_COMPILER) $< \
        && touch $@

.first.%.pdf: %.tex
    $(PDFTEX_COMPILER_BATCH) $< \
        && touch $@

.first.%.ps:
    @file="`echo '$@' | sed 's/^.first.//g;'`"; \
    echo "$(TEX_COMPILER_BATCH) $${file%.ps}.tex"; \
    $(TEX_COMPILER_BATCH) $${file%.ps}.tex \
        && touch $@ || (cat $${file%.ps}.log; exit 1 )

ifneq ($(strip $(PREFIX)),) # prefixed directories {{{
view: 
    for i in $(OUTPUT); do \
        test -f "$$i" && $(GV) "$$i" & \
    done

view: 
    for i in $(OUTPUT); do \
        test -f "$(PREFIX)-$$i" && $(GV) "$(PREFIX)-$$i" & \
    done

endif

#
# A rule to do nothing
#
dummy:

documents: doc

ifeq ($(strip $(SUBDIRS)),)
SUBDIRS = $(shell sed 's/\#.*$$//g;' SUBDIRS 2>/dev/null)
endif

ifneq ($(strip $(SUBDIRS)),)

doc: doc-subdirs all

subdir-list-doc = $(sort $(patsubst %,_subdir_doc_%,$(SUBDIRS)))
doc-subdirs: dummy $(subdir-list-doc)

$(subdir-list-doc) : dummy
    @if [ -d "$(patsubst _subdir_doc_%,%,$@)" ]; then \
        echo -e "$(GREEN)Making documents in directory $(MAGENTA)'$(patsubst _subdir_doc_%,%,$@)'$(RESET)"; \
        $(MAKE) -C $(patsubst _subdir_doc_%,%,$@) doc; \
        echo -e "$(GREEN)Make in directory $(MAGENTA)'$(patsubst _subdir_doc_%,%,$@)'$(GREEN) done.$(RESET)"; \
    else \
        echo -e "$(RED)Skipping nonexistent directory $(MAGENTA)'$(patsubst _subdir_doc_%,%,$@)'$(RESET)"; \
    fi
        

else

doc: all
    
endif # ifdef SUBDIRS


# Clean {{{

#
# A rule to make clean in subdirectories
#
ifneq ($(strip $(SUBDIRS)),)

clean: clean-subdirs clean-tex-logs clean-graphs clean-postscript clean-pdf clean-html clean-rtf
    -rm -f .first.* .second.* .third.* core core.* missfont.log

subdir-list-clean = $(sort $(patsubst %,_subdir_clean_%,$(SUBDIRS)))
clean-subdirs: dummy $(subdir-list-clean)

$(subdir-list-clean) : dummy
    @if [ -d "$(patsubst _subdir_clean_%,%,$@)" ]; then \
        echo -e "$(GREEN)Cleaning documents in directory $(MAGENTA)'$(patsubst _subdir_clean_%,%,$@)'$(RESET)"; \
        $(MAKE) -C $(patsubst _subdir_clean_%,%,$@) clean; \
        echo -e "$(GREEN)Clean in directory $(MAGENTA)'$(patsubst _subdir_clean_%,%,$@)'$(GREEN) done.$(RESET)"; \
    else \
        echo -e "$(RED)Skipping nonexistent directory $(MAGENTA)'$(patsubst _subdir_clean_%,%,$@)'$(RESET)"; \
    fi

else

clean:               clean-tex-logs clean-graphs clean-postscript clean-pdf clean-html clean-rtf
    -rm -f .first.* .second.* .third.* core core.*

endif # ifdef SUBDIRS

ifneq ($(strip $(PREFIX)),)
clean-postscript:
    -rm -rf PostScript/ $(prefix_ps__OUTPUT)

clean-pdf:
    -rm -rf PDF/ $(prefix_pdf_OUTPUT)

clean-html:
    -rm -rf HTML/ $(prefix_htm_OUTPUT)

clean-rtf:
    -rm -rf RTF/ $(prefix_rtf_OUTPUT)
else
clean-postscript:
    -rm -rf PostScript/

clean-pdf:
    -rm -rf PDF/

clean-html:
    -rm -rf HTML/

clean-rtf:
    -rm -rf RTF/
endif

# zmazanie docasnych suborov vytvorenych LaTeXom
ifneq ($(strip $(OUTPUT)),)
clean-tex-logs:
    @for OUT in $(OUTPUT); \
    do \
        file="$${OUT%.ps}"; \
        file_list=""; \
        for i in $${file%.pdf}{.aux,.brf,.log,.lof,.lot,.out,.toc,.dvi,.ps,.pdf} ; \
        do \
            file_list="$$file_list $$i"; \
        done; \
    done; \
    filelist="`echo $$file_list | awk -v RS=' ' '{print}' | sort -u | awk -v ORS=' ' '{print}'`"; \
    echo -e "$(CYAN)Deleting extensions `echo $$asdf{.aux,.brf,.log,.lof,.lot,.out,.toc,.dvi,.ps,.pdf} `$(RESET)"; \
    echo "rm -f $$filelist"; \
    rm -f $$filelist;
else
clean-tex-logs:
    @filelist="`ls *{.aux,.brf,.log,.lof,.lot,.out,.toc,.dvi,.ps,.pdf} 2>/dev/null`"; \
    if [ ! -z "$$filelist" ]; then \
        echo -e "$(CYAN)Deleting files `echo $$asdf{.aux,.brf,.log,.lof,.lot,.out,.toc,.dvi,.ps,.pdf} `$(RESET)"; \
        echo "rm -f $$filelist"; \
        rm -f $$filelist; \
    fi
endif

# zmazanie vytvorenych grafov
clean-graphs:
    @test -z "$(GRAPHS)" || \
    for i in "$(GRAPHS)" ; \
    do \
        echo "rm -f $$i"; rm -f $$i; \
    done \
# }}}

# Distribution {{{

ifneq ($(strip $(SUBDIRS)),)

subdir-copy-distfile = $(sort $(patsubst %,_subdir_copy_distfile_%,$(SUBDIRS)))

export DISTFILE_DEST
$(subdir-copy-distfile) : dummy
    @if [ -d "$(patsubst _subdir_copy_distfile_%,%,$@)" ]; then \
        echo -e "$(GREEN)Copying distfile from directory $(MAGENTA)'$(patsubst _subdir_copy_distfile_%,%,$@)'$(RESET)"; \
        $(MAKE) -C $(patsubst _subdir_copy_distfile_%,%,$@) copy-distfile; \
        echo -e "$(GREEN)Copying distfile from directory $(MAGENTA)'$(patsubst _subdir_copy_distfile_%,%,$@)'$(GREEN) done.$(RESET)"; \
    else \
        echo -e "$(RED)Skipping nonexistent directory $(MAGENTA)'$(patsubst _subdir_copy_distfile_%,%,$@)'$(RESET)"; \
    fi

endif


ifneq ($(strip $(DISTFILES)),)

$(distdir).tar.gz: dist
dist: distdir
    GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz  $(distdir)
    @#BZIP=$(GZIP_ENV) $(TAR) chojf $(distdir).tar.bz2 $(distdir)
    -rm -rf $(distdir)
    @#-@banner="md5sum is: `md5sum $(distdir).tar.gz |tee md5sum.$(distdir)`"; \
    dashes=`echo "$$banner" | sed s/./=/g`; \
    echo "$$dashes"; \
    echo "$$banner"; \
    echo "$$dashes"

distdir: $(DISTFILES)
    -rm -rf $(distdir)
    mkdir $(distdir)
    -chmod a+rx $(distdir)
    @here=`cd $(top_builddir) && pwd`; \
    top_distdir=`cd $(distdir) && pwd`; \
    distdir=`cd $(distdir) && pwd`; \
    umask 022; \
    for file in $(DISTFILES); do \
      d=$(srcdir); \
      if test -d $$d/$$file; then \
        mkdir $(distdir)/$$file; \
      else \
        test -f $(distdir)/$$file \
        || cp $$d/$$file $(distdir)/$$file || :; \
      fi; \
    done

ifneq ($(strip $(SUBDIRS)),)
copy-distfile: subdir-copy-distfile $(distdir).tar.gz
endif
copy-distfile: $(distdir).tar.gz
    @if [ ! -z "$$DISTFILE_DEST" ]; then \
        ln $(distdir).tar.gz "$$DISTFILE_DEST" \
         || cp $(distdir).tar.gz "$$DISTFILE_DEST"; \
    else \
        echo '$$DISTFILE_DEST is not set, ignoring target $@'; \
    fi

else # ifneq ($(strip $(DISTFILES)),)

$(distdir).tar.gz:
dist:
distdir:
ifneq ($(strip $(SUBDIRS)),)
copy-distfile: dummy $(subdir-copy-distfile)
else
copy-distfile:
endif

endif

# }}}

# vim: ts=4 isk+=- ft=make
# vim600: fdm=marker fdc=3


Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok