]> git.stg.codes - ssmd.git/blobdiff - Makefile
Ignore more files.
[ssmd.git] / Makefile
index 1d3630f8ebbd59aec03bdfea866b86c792108764..ad0f66296af2ad48e6895f2f25dbd46c2315d42e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,19 @@
-DEFS = 
+ifeq ($(BUILD),Debug)
+       DEFS += -DDEBUG
+       CXXFLAGS += -g3
+endif
+
 INCS = -Iinclude -I3rdparty/snmp++/include
 CXXFLAGS += -W -Wall -Wextra $(INCS) $(DEFS)
-LIBS = -lpthread \
-       -lssl \
-       -lcurl \
+LIBS = 3rdparty/snmp++/libsnmp++.a \
        -lboost_system \
        -lboost_program_options \
-       3rdparty/snmp++/libsnmp++.a
+       -lcurl \
+       -lssl \
+       -lcrypto \
+       -lpthread
 PROG = ssmd # SNMP Switch Management Daemon
-VERSION = 1.1.2
+VERSION = 1.2.2
 
 SOURCES = src/main.cpp \
          src/pidfile.cpp \
@@ -22,7 +27,12 @@ SOURCES = src/main.cpp \
          src/snmptable.cpp \
          src/dataparser.cpp
 
-.PHONY: all clean snmplib version tests
+PREFIX =
+BIN_MODE = 0755
+DATA_MODE = 0644
+OWNER = root
+
+.PHONY: all clean snmplib version tests install uninstall
 
 all: $(PROG)
 
@@ -44,6 +54,26 @@ $(PROG): version $(subst .cpp,.o,$(SOURCES)) snmplib
 clean: snmplib
        rm -f src/*.o src/*.d $(PROG) include/version.h
 
+install: install-bin install-data
+
+install-bin:
+ifeq ($(findstring $(DEFS), -DDEBUG),)
+       install -D -m $(BIN_MODE) -o $(OWNER) $(PROG) $(PREFIX)/usr/sbin/$(PROG)
+else
+       install -D -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
+endif
+
+install-data:
+       install -D -m $(DATA_MODE) -o $(OWNER) ./ssmd.conf $(PREFIX)/etc/ssmd/ssmd.conf
+
+uninstall: uninstall-bin uninstall-data
+
+uninstall-bin:
+       rm -f $(PREFIX)/usr/sbin/$(PROG)
+
+uninstall-data:
+       rm -f $(PREFIX)/etc/ssmd/ssmd.conf
+
 ifneq ($(MAKECMDGOALS),distclean)
 ifneq ($(MAKECMDGOALS),clean)
 -include $(subst .cpp,.d,$(SOURCES))