73 lines
1.8 KiB
Makefile
73 lines
1.8 KiB
Makefile
BUILD := $(shell date -u +%Y%m%d-%H%M%S)
|
|
OS := $(shell uname -s)
|
|
|
|
PREFIX = $(DESTDIR)/opt/CronosAgent
|
|
|
|
DIRECTORIES =
|
|
|
|
ifeq ($(OS), Linux)
|
|
LIBRARIES += \
|
|
rt
|
|
# DEPENDENCIES = \
|
|
# openssl
|
|
endif
|
|
|
|
ifeq ($(OS), Darwin)
|
|
# CFLAGS += \
|
|
# -Wno-deprecated-declarations \
|
|
# -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include/
|
|
# LIBRARIES += \
|
|
# crypto
|
|
endif
|
|
|
|
OBJECTS = \
|
|
sha256.o \
|
|
CronosAgent.o
|
|
|
|
FLAGS := -g -fno-omit-frame-pointer -O3 -MMD $(foreach directory, $(DIRECTORIES), -I$(directory)) -DBUILD=\"$(BUILD)\"
|
|
LIBS := $(foreach library, $(LIBRARIES), -l$(library))
|
|
|
|
CC = gcc
|
|
CFLAGS += $(FLAGS) -std=gnu99
|
|
|
|
ifeq ($(OS), Linux)
|
|
FLAGS += $(shell pkg-config --cflags $(DEPENDENCIES)) -rdynamic
|
|
LIBS += $(shell pkg-config --libs $(DEPENDENCIES))
|
|
endif
|
|
|
|
all: build
|
|
|
|
build: $(PREREQUISITES) $(OBJECTS)
|
|
$(CC) $(OBJECTS) $(FLAGS) $(LIBS) -o cronosagent
|
|
|
|
install:
|
|
install -D -d $(PREFIX)
|
|
install -o root -g root cronosagent $(PREFIX)
|
|
install -o root -g root cronosagent.sh $(PREFIX)
|
|
install -o root -g root cronosagent.conf $(PREFIX)
|
|
ifeq ($(OS), Linux)
|
|
install -o root -g root cronosagent-init $(PREFIX)
|
|
install -m 644 -o root -g root cronosagent-monit $(PREFIX)
|
|
install -m 644 -o root -g root cronosagent.service $(PREFIX)
|
|
endif
|
|
ifeq ($(OS), Darwin)
|
|
install -m 644 -o root -g root cronosagent.plist $(DESTDIR)/Library/LaunchDaemons
|
|
endif
|
|
|
|
clean:
|
|
rm -f $(PREREQUISITES) $(OBJECTS) cronosagent
|
|
rm -f *.d
|
|
|
|
version:
|
|
# echo "#define VERSION $(shell svn info | grep -E "^Revision:" | grep -o -E "[0-9]+")" > Version.h
|
|
echo "#define VERSION $(shell date -u +%Y%m%d)" > Version.h
|
|
|
|
debian-package:
|
|
./UpdateLog.sh
|
|
ifdef ARCH
|
|
dpkg-buildpackage -b -a$(ARCH) -tc
|
|
else
|
|
dpkg-buildpackage -b -tc
|
|
endif
|
|
|
|
.PHONY: all build clean install
|