From f1627aa6828e2cb762c5860928fd9ec50805dd0b Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 6 Dec 2023 10:05:52 +0100 Subject: [PATCH] workflow: properly generate `version.h` --- Makefile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8d955d4..d5029bd 100644 --- a/Makefile +++ b/Makefile @@ -66,16 +66,23 @@ TARGET_OBJS = $(filter-out third_party/%, $(filter-out tests/%, $(OBJS))) all: version +make $(TARGET) +install: version + +make $(TARGET) + install $(TARGET) $(DESTDIR)/usr/local/bin/ + .SUFFIXES: ifeq (1,$(USE_LIBDATACHANNEL)) camera-streamer: $(LIBDATACHANNEL_PATH)/build/libdatachannel-static.a endif +camera-streamer: $(filter-out cmd/%, $(TARGET_OBJS)) $(filter cmd/camera-streamer/%, $(TARGET_OBJS)) + $(CCACHE) $(CXX) $(CFLAGS) -o $@ $^ $(LDLIBS) + .PHONY: version version: echo "#define GIT_VERSION \"$(GIT_VERSION)\"\n#define GIT_REVISION \"$(GIT_REVISION)\"" > version.h.tmp - if $(CXX) $(CFLAGS) -o /dev/null -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; \ else \ echo "#define LIBCAMERA_USES_TRANSFORM" >> version.h.tmp; \ @@ -83,14 +90,8 @@ version: diff -u version.h version.h.tmp || mv version.h.tmp version.h -rm -f version.h.tmp -%: cmd/% $(TARGET_OBJS) - $(CCACHE) $(CXX) $(CFLAGS) -o $@ $(filter-out cmd/%, $^) $(filter $ $@.tmp mv $@.tmp $@