74 lines
1.8 KiB
Makefile
74 lines
1.8 KiB
Makefile
CC ?= cc
|
|
CFLAGS ?= -O2 \
|
|
-pipe \
|
|
-fstack-protector-strong \
|
|
-Wall \
|
|
-Wextra \
|
|
-Wmissing-declarations \
|
|
-pedantic
|
|
LDFLAGS ?= -lcrypto -lssl \
|
|
-lpthread \
|
|
-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
|
|
override CFLAGS += $(shell mysql_config --cflags)
|
|
override LDFLAGS += $(shell mysql_config --libs)
|
|
|
|
# Use this to store compile flags and debug info.
|
|
# You may simply check the flags later with:
|
|
# $ readelf -p .GCC.command.line rmpsd
|
|
ifeq ($(DEBUG), yes)
|
|
CFLAGS += -frecord-gcc-switches -g
|
|
endif
|
|
|
|
SRCDIR = src
|
|
OBJDIR = obj
|
|
BUILDDIR = build
|
|
|
|
SOURCES := $(wildcard $(SRCDIR)/*.c)
|
|
INCLUDES := $(wildcard $(SRCDIR)/*.h)
|
|
OBJECTS := $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
|
|
EXECUTABLE = rmpsd
|
|
INSTALLDIR := $(DESTDIR)/usr/bin
|
|
|
|
$(BUILDDIR)/$(EXECUTABLE): $(OBJECTS)
|
|
ifeq ($(VERBOSE), yes)
|
|
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
|
else
|
|
@echo ' LD $@'
|
|
@$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
|
endif
|
|
|
|
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
|
|
ifeq ($(VERBOSE), yes)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
else
|
|
@echo ' CC $<'
|
|
@$(CC) $(CFLAGS) -c $< -o $@
|
|
endif
|
|
|
|
.PHONY: agent
|
|
agent:
|
|
$(MAKE) -C agent
|
|
|
|
.PHONY: clean_agent
|
|
clean_agent:
|
|
$(MAKE) -C agent clean
|
|
|
|
clean:
|
|
rm -f $(OBJECTS) $(BUILDDIR)/$(EXECUTABLE)
|
|
|
|
distclean:
|
|
rm -f $(OBJECTS)
|
|
|
|
install:
|
|
install -m755 -D $(BUILDDIR)/$(EXECUTABLE) "$(INSTALLDIR)/$(EXECUTABLE)"
|
|
install -m644 -D docs/conf/rmps.conf "$(DESTDIR)/etc/rmps/rmps.conf"
|
|
install -m644 -D docs/systemd/rmpsd.service "$(DESTDIR)/usr/lib/systemd/system/rmpsd.service"
|
|
install -m644 -D docs/enum_codes "$(DESTDIR)/usr/lib/rmps/resources/enum_codes"
|
|
|
|
uninstall:
|
|
rm -f "$(INSTALLDIR)/$(EXECUTABLE)"
|
|
rm -f "$(DESTDIR)/etc/rmps/rmps.conf"
|
|
rm -f "$(DESTDIR)/usr/lib/systemd/system/rmpsd.service"
|
|
rm -f "$(DESTDIR)/usr/lib/rmps/resources/enum_codes"
|
|
|