Create the GitVersion.h file under Linux.

This commit is contained in:
Jonathan Naylor 2024-04-22 14:12:04 +01:00
parent 512f53e05f
commit 71059ec44e
3 changed files with 35 additions and 4 deletions

View File

@ -8,15 +8,30 @@ OBJECTS = Conf.o DMRLookup.o Log.o Mutex.o P25Gateway.o P25Network.o Reflectors.
all: P25Gateway
P25Gateway: $(OBJECTS)
P25Gateway: GitVersion.h $(OBJECTS)
$(CXX) $(OBJECTS) $(CFLAGS) $(LIBS) -o P25Gateway
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
P25Gateway.o: GitVersion.h FORCE
.PHONY: GitVersion.h
FORCE:
install:
install -m 755 P25Gateway /usr/local/bin/
clean:
$(RM) P25Gateway *.o *.d *.bak *~
# Export the current git version if the index file exists, else 000...
GitVersion.h:
ifneq ("$(wildcard ../.git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif

View File

@ -28,7 +28,7 @@
#include "Timer.h"
#include "Utils.h"
#include "Log.h"
#include "GitVersion.h""
#include "GitVersion.h"
#if defined(_WIN32) || defined(_WIN64)
#include <WS2tcpip.h>

View File

@ -8,14 +8,30 @@ OBJECTS = Network.o P25Parrot.o Parrot.o StopWatch.o Thread.o Timer.o UDPSocket.
all: P25Parrot
P25Parrot: $(OBJECTS)
P25Parrot: GitVersion.h $(OBJECTS)
$(CXX) $(OBJECTS) $(CFLAGS) $(LIBS) -o P25Parrot
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
P25Parrot.o: GitVersion.h FORCE
.PHONY: GitVersion.h
FORCE:
install:
install -m 755 P25Parrot /usr/local/bin/
clean:
$(RM) P25Parrot *.o *.d *.bak *~
# Export the current git version if the index file exists, else 000...
GitVersion.h:
ifneq ("$(wildcard ../.git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif