Next: , Up: Distributions   [Contents][Index]


11.1 Distribution tar Files

The tar file for version m.n of program foo should be named foo-m.n.tar. It should unpack into a subdirectory named foo-m.n. Tar files should not unpack into files in the current directory, because this is inconvenient if the user happens to unpack into a directory with other files in it.

Here is how the Makefile for Bison creates the tar file. This method is good for other programs.

dist: bison.info
        echo bison-`sed -e '/version_string/!d' \
          -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q version.c` > .fname
        -rm -rf `cat .fname`
        mkdir `cat .fname`
        dst=`cat .fname`; for f in $(DISTFILES); do \
           ln $(srcdir)/$$f $$dst/$$f || { echo copying $$f; \
             cp -p $(srcdir)/$$f $$dst/$$f ; } \
        done
        tar --gzip -chf `cat .fname`.tar.gz `cat .fname`
        -rm -rf `cat .fname` .fname

Source files that are symbolic links to other file systems cannot be installed in the temporary directory using ln, so use cp if ln fails.

Using Automake is a good way to take care of writing the dist target.