From 521e61c099bd8c19027d0d9d4a1796812ff05c52 Mon Sep 17 00:00:00 2001 From: r3abm Date: Sun, 23 Mar 2025 13:53:05 +0200 Subject: [PATCH] Update Makefile --- Makefile | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 138ace1..a584c8f 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,21 @@ DIRECTORIES = \ $(TOOLKIT)/Common \ $(TOOLKIT)/Rewind -ifeq ($(OS), Linux) - FLAGS += -rdynamic - KIND := $(shell grep -E "^6.0" /etc/debian_version > /dev/null ; echo $?) -ifneq ($(KIND), 0) - LIBRARIES += rt +ifeq ($(CI_PIPELINE_CREATED_AT), ) + VERSION := $(shell date -u +%Y%m%d-%H%M%S) +else + VERSION := $(shell date -u -d "$(CI_PIPELINE_CREATED_AT)" +%Y%m%d-%H%M%S) endif + +ifeq ($(OS), Linux) + ARCHITECTURE ?= $(shell $(CC) -dumpmachine | grep -o -E '^[^-]+') +ifeq ($(ARCHITECTURE), aarch64) + FLAGS += -march=armv8-a +endif +ifeq ($(ARCHITECTURE), x86_64) + FLAGS += -fPIC +endif + FLAGS += -rdynamic endif ifeq ($(OS), Darwin) @@ -23,7 +32,10 @@ endif OBJECTS = \ TellusAgent.o -FLAGS += -g -fno-omit-frame-pointer -O3 -MMD $(foreach directory, $(DIRECTORIES), -I$(directory)) -DBUILD=\"$(BUILD)\" +FLAGS += -g -fno-omit-frame-pointer -O3 -MMD \ + -DVERSION=\"$(VERSION)\" \ + $(foreach directory, $(DIRECTORIES), -I$(directory)) -DBUILD=\"$(BUILD)\" + LIBS += $(foreach library, $(LIBRARIES), -l$(library)) CC = gcc @@ -59,9 +71,6 @@ clean: rm -f $(PREREQUISITES) $(OBJECTS) tellusagent rm -f *.d $(TOOLKIT)/*/*.d -version: - echo "#define VERSION $(shell date -u +%Y%m%d)" > Version.h - debian-package: ./UpdateLog.sh ifdef ARCH