build: use printf instead of echo (#110)

This commit is contained in:
Zeyu Dong 2025-06-08 12:46:11 -04:00 committed by GitHub
parent 598dd6b922
commit f73ac32944
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -81,11 +81,11 @@ camera-streamer: $(filter-out cmd/%, $(TARGET_OBJS)) $(filter cmd/camera-streame
.PHONY: version .PHONY: version
version: version:
echo "#define GIT_VERSION \"$(GIT_VERSION)\"\n#define GIT_REVISION \"$(GIT_REVISION)\"" > version.h.tmp printf "#define GIT_VERSION \"$(GIT_VERSION)\"\n#define GIT_REVISION \"$(GIT_REVISION)\"\n" > version.h.tmp
if $(CCACHE) $(CXX) $(CFLAGS) -o tests/libcamera/orientation.o -c tests/libcamera/orientation.cc 2>/dev/null; then \ if $(CCACHE) $(CXX) $(CFLAGS) -o tests/libcamera/orientation.o -c tests/libcamera/orientation.cc 2>/dev/null; then \
echo "#define LIBCAMERA_USES_ORIENTATION" >> version.h.tmp; \ printf "#define LIBCAMERA_USES_ORIENTATION\n" >> version.h.tmp; \
else \ else \
echo "#define LIBCAMERA_USES_TRANSFORM" >> version.h.tmp; \ printf "#define LIBCAMERA_USES_TRANSFORM\n" >> version.h.tmp; \
fi fi
diff -u version.h version.h.tmp || mv version.h.tmp version.h diff -u version.h version.h.tmp || mv version.h.tmp version.h
-rm -f version.h.tmp -rm -f version.h.tmp