Skip to content

Commit

Permalink
Only copy headers to release dir if contents changed
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuber21 committed Oct 23, 2024
1 parent 4145d40 commit 2c4652d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,8 @@ $(CORE.incdirs): _release_c_h

define .release.dd
$3: $2
$2: $1 ; $(value mkdir)$(value cpy)
$2: $1 ; $(value mkdir)
@if [ ! -f $2 ] || ! cmp -s $1 $2; then $(value cpy); fi
$(if $(filter %library_version_info.h,$2),+$(daalmake) -f makefile update_headers_version)
$(if $(USECPUS.out.defs.filter),$(if $(filter %daal_kernel_defines.h,$2),$(USECPUS.out.defs.filter) $2; rm -rf $(subst .h,.h.bak,$2)))
endef
Expand Down
23 changes: 16 additions & 7 deletions makefile.ver
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,20 @@ $(VERSION_DATA_FILE): | $(WORKDIR)/.
@bash -c 'echo "$$DAAL_VERSION_DATA"' > $@

# update public headers in release directory with actual version data
# copy file only if the result is different from the previous run
# to avoid interference with incremental builds
update_headers_version:
@file=$(RELEASEDIR.include)/services/library_version_info.h && mark="#define __INTEL_DAAL" && \
sed $(sed.-b) $(sed.-i) -e "s/_DAAL_BUILD_DATE.*/_DAAL_BUILD_DATE $(BUILD)$(sed.eol)/" \
-e "s/\($${mark}__\).*/\1 $(MAJOR)$(sed.eol)/;s/\($${mark}_MINOR__\).*/\1 $(MINOR)$(sed.eol)/" \
-e "s/\($${mark}_MAJOR_BINARY__\).*/\1 $(MAJORBINARY)$(sed.eol)/;s/\($${mark}_MINOR_BINARY__\).*/\1 $(MINORBINARY)$(sed.eol)/" \
-e "s/\($${mark}_UPDATE__\).*/\1 $(UPDATE)$(sed.eol)/" \
-e "s/\($${mark}_STATUS__\).*/\1 \"$(STATUS)\"$(sed.eol)/" $$file && \
rm -f $$file.bak
@file=$(RELEASEDIR.include)/services/library_version_info.h && \
tempfile=$${file}.tmp && \
mark="#define __INTEL_DAAL" && \
sed $(sed.-b) $(sed.-i) -e "s/_DAAL_BUILD_DATE.*/_DAAL_BUILD_DATE $(BUILD)$(sed.eol)/" \
-e "s/\($${mark}__\).*/\1 $(MAJOR)$(sed.eol)/;s/\($${mark}_MINOR__\).*/\1 $(MINOR)$(sed.eol)/" \
-e "s/\($${mark}_MAJOR_BINARY__\).*/\1 $(MAJORBINARY)$(sed.eol)/;s/\($${mark}_MINOR_BINARY__\).*/\1 $(MINORBINARY)$(sed.eol)/" \
-e "s/\($${mark}_UPDATE__\).*/\1 $(UPDATE)$(sed.eol)/" \
-e "s/\($${mark}_STATUS__\).*/\1 \"$(STATUS)\"$(sed.eol)/" $$file > $$tempfile && \
if [ ! -f $$file ] || ! cmp -s $$tempfile $$file; then \
# echo "Updating $$file with new version data."; \
mv $$tempfile $$file; \
else \
rm $$tempfile; \
fi

0 comments on commit 2c4652d

Please sign in to comment.