diff --git a/Makefile.common b/Makefile.common index 33c9bd7..d21a3b7 100644 --- a/Makefile.common +++ b/Makefile.common @@ -88,11 +88,15 @@ RPM_BUILD_DIR ?= $(BUILDDIR)/$(NAME)-$(VERSION) #needed for archivefile rule TREEPATH := $(NAME)-$(VERSION) +CODEDIR := "root" EXT := $(shell cat $(NAME).spec | grep -e '^[S|s]ource' | head -n 1 | sed 's/Source: //' | sed -E 's/^([^.]*\.)(.*)$/\2//') #ARCHIVEFILE=$(cat ${NAME}.spec | grep -e '^[S|s]ource' | sed -r 's/^[S|s]ource[0-9]?:\s?//' | xargs basename) #ARCHIVEFILE=$(rpm --queryformat "${ARCHIVEFILE}\n" --specfile ${NAME}.spec | head -n 1) -ARCHIVEFILE := $(shell cat archivefilename) - +ifeq (,$(wildcard archivefilename)) +ARCHIVEFILE := "$(NAME)-$(VERSION).tar.gz" +else +ARCHIVEFILE := $(cat archivefilename) +endif # default target: just make sure we've got the sources all: sources @@ -345,6 +349,11 @@ endif $(ARCHIVEFILE): $(info "${NAME} $(ARCHIVEFILE) $(TREEPATH)") $(info "Making archive file ${ARCHIVEFILE}") + if [ -d ${TREEPATH} ] ; then rm -Rf ${TREEPATH} ; fi ; \ + mkdir -p ${TREEPATH} ; \ + if [ -d ${CODEDIR} ] ; then cp -R "${CODEDIR}" "${TREEPATH}/root" ; fi ; \ + if [ -e createlinks ] ; then cp createlinks "${TREEPATH}/." ; fi ; \ + if [ -d additional ] ; then cp additional/* "${TREEPATH}/." ; fi ; \ tar -czf ${ARCHIVEFILE} ${TREEPATH} ;\ ls -l ${ARCHIVEFILE} ;