only run make when files have changed? - Unix

This is a discussion on only run make when files have changed? - Unix ; I have made this makefile that converts eps and ps files to pdf: # Contains all .eps files. EPSFILES=$(wildcard *.eps) # Contains all .ps files. PSFILES=$(wildcard *.ps) # Create target label for eps files EPSLABEL=$(EPSFILES:%.eps=%.eps2pdf) # Create target label for ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: only run make when files have changed?

  1. only run make when files have changed?

    I have made this makefile that converts eps and ps files to pdf:


    # Contains all .eps files.
    EPSFILES=$(wildcard *.eps)

    # Contains all .ps files.
    PSFILES=$(wildcard *.ps)

    # Create target label for eps files
    EPSLABEL=$(EPSFILES:%.eps=%.eps2pdf)

    # Create target label for ps files
    PSLABEL=$(PSFILES:%.ps=%.ps2pdf)


    all: topdf


    # =============================================
    # Convert to PDF
    # =============================================
    topdf: $(EPSLABEL) $(PSLABEL)

    %.eps2pdf: %.eps
    epstopdf $<


    %.ps2pdf: %.ps
    epstopdf $<



    But even though the eps or ps files have not changed it runs the
    epstopdf command on all the files.

    Why does make not only run the command when the files have changed?

  2. Re: only run make when files have changed?

    In article , saneman wrote:

    >%.eps2pdf: %.eps
    > epstopdf $<



    >But even though the eps or ps files have not changed it runs the
    >epstopdf command on all the files.
    >
    >Why does make not only run the command when the files have changed?


    What is the name of the file that your epstopdf command creates?


    dave

    --
    Dave Vandervies dj3vande at eskimo dot com
    Are you *trying* to get killfiled?
    (Incidentally, you succeeded.)
    --Richard Heathfield in comp.lang.c

  3. Re: only run make when files have changed?

    saneman writes:

    > I have made this makefile that converts eps and ps files to pdf:


    I think you want:

    > # Contains all .eps files.
    > EPSFILES=$(wildcard *.eps)
    >
    > # Contains all .ps files.
    > PSFILES=$(wildcard *.ps)
    >
    > # Create target label for eps files
    > EPSLABEL=$(EPSFILES:%.eps=%.eps2pdf)


    EPSLABEL=$(EPSFILES:%.eps=%.pdf)

    > # Create target label for ps files
    > PSLABEL=$(PSFILES:%.ps=%.ps2pdf)


    PSLABEL=$(PSFILES:%.ps=%.pdf)

    > all: topdf
    >
    >
    > # =============================================
    > # Convert to PDF
    > # =============================================
    > topdf: $(EPSLABEL) $(PSLABEL)
    >
    > %.eps2pdf: %.eps


    %.pdf: %.eps

    > epstopdf $<


    > %.ps2pdf: %.ps


    %.pdf: %.ps

    > epstopdf $<


    > Why does make not only run the command when the files have changed?


    Because you are inventing names that never get "made".

    --
    Ben.

  4. Re: only run make when files have changed?

    On Mar 7, 8:22 am, saneman wrote:
    > I have made this makefile that converts eps and ps files to pdf:
    >
    > # Contains all .eps files.
    > EPSFILES=$(wildcard *.eps)
    >
    > # Contains all .ps files.
    > PSFILES=$(wildcard *.ps)
    >
    > # Create target label for eps files
    > EPSLABEL=$(EPSFILES:%.eps=%.eps2pdf)
    >
    > # Create target label for ps files
    > PSLABEL=$(PSFILES:%.ps=%.ps2pdf)
    >
    > all: topdf
    >
    > # =============================================
    > # Convert to PDF
    > # =============================================
    > topdf: $(EPSLABEL) $(PSLABEL)
    >
    > %.eps2pdf: %.eps
    > epstopdf $<
    >
    > %.ps2pdf: %.ps
    > epstopdf $<
    >
    > But even though the eps or ps files have not changed it runs the
    > epstopdf command on all the files.
    >
    > Why does make not only run the command when the files have changed?



    This is answered in your other thread. Also Ben gives a good hint.
    Please read 'info make' or
    http://www.gnu.org/software/make/man...l#Static-Usage

+ Reply to Thread