build: Use git version for tarball and AC_INIT().
[paraslash.git] / Makefile.real
index bc3bf616451eae0a716ffa2d041fc6341630a7a5..13933b78ac052b1bbd24a4c0b5e29e5c9de3b6c8 100644 (file)
@@ -51,7 +51,7 @@ play_objs := $(addprefix $(object_dir)/, $(play_objs))
 man_pages := $(patsubst %, $(man_dir)/%.1, $(prefixed_executables))
 
 autocrap := config.h.in configure
-tarball_pfx := $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
+tarball_pfx := $(PACKAGE_TARNAME)-$(shell git describe --dirty)
 tarball_delete := $(addprefix $(tarball_pfx)/, web .gitignore)
 tarball := $(tarball_pfx).tar.bz2
 
@@ -244,10 +244,15 @@ $(object_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h
        @[ -z "$(Q)" ] || echo 'CC $<'
        $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
 
-$(dep_dir)/%.d: %.c error2.h | $(dep_dir) $(cmdlist_dir)
+# The compiler outputs dependencies either as foo.h or as some_directory/foo.h,
+# depending on whether the latter file exists. Since make needs the directory
+# part we prefix the dependency as appropriate.
+$(dep_dir)/%.d: %.c error2.h | $(dep_dir)
        @[ -z "$(Q)" ] || echo 'DEP $<'
-       $(Q) ./depend.sh $(dep_dir) $(object_dir) $(cmdline_dir) \
-               $(cmdlist_dir) $(CPPFLAGS) $< > $@
+       $(Q) $(CC) $(CPPFLAGS) -MM -MG -MP -MT $@ -MT $(object_dir)/$(*F).o $< \
+               | sed -e "s@ \([a-zA-Z0-9_]\{1,\}\.cmdline.h\)@ $(cmdline_dir)/\1@g" \
+               -e "s@ \([a-zA-Z0-9_]\{1,\}\.command_list.h\)@ $(cmdlist_dir)/\1@g" \
+               -e "s@ \([a-zA-Z0-9_]\{1,\}\.completion.h\)@ $(cmdlist_dir)/\1@g" > $@
 
 para_recv para_afh para_play para_server: LDFLAGS += $(id3tag_ldflags)
 para_write para_play para_audiod: LDFLAGS += $(ao_ldflags) $(core_audio_ldflags)
@@ -315,7 +320,6 @@ clean2: clean
 distclean: clean2 test-clean
        @[ -z "$(Q)" ] || echo 'DISTCLEAN'
        $(Q) rm -f Makefile autoscan.log config.status config.log error2.h
-       $(Q) rm -rf autom4te.cache
        $(Q) rm -f GPATH GRTAGS GSYMS GTAGS
 
 maintainer-clean: distclean
@@ -339,4 +343,5 @@ $(tarball):
        $(Q) tar rf $(tarball_pfx).tar $(tarball_pfx)/*
        $(Q) bzip2 -9 $(tarball_pfx).tar
        $(Q) ls -l $(tarball)
+       $(Q) ln -sf $(tarball) paraslash-git.tar.bz2
        $(Q) rm -rf $(tarball_pfx)