adds Makefile (removes build.sh); new Versioning method
This commit is contained in:
parent
89846017ec
commit
c4f3dfae3a
3 changed files with 32 additions and 9 deletions
22
Makefile
Executable file
22
Makefile
Executable file
|
@ -0,0 +1,22 @@
|
|||
GIT_VERSION := "$(shell git describe --abbrev=6 --dirty --always --tags)"
|
||||
|
||||
PREFIX=/usr/local/sbin
|
||||
|
||||
CC = g++
|
||||
CFLAGS = -O2 -pipe -fomit-frame-pointer -Wall -s -pie -fpie
|
||||
LFLAGS = -lboost_system
|
||||
VERSION_FLAGS = -DVERSION=\"$(GIT_VERSION)\"
|
||||
|
||||
.PHONY: all clean install
|
||||
|
||||
all: clean blacklist
|
||||
|
||||
blacklist:blacklist.cpp
|
||||
$(CC) $(CFLAGS) $(LFLAGS) $(VERSION_FLAGS) -o $@ $^
|
||||
|
||||
clean:
|
||||
rm -f blacklist
|
||||
|
||||
install:
|
||||
install -D -o root -g root -m 750 blacklist $(PREFIX)/blacklist
|
||||
|
|
@ -43,7 +43,6 @@
|
|||
#include <boost/range/algorithm/unique.hpp> // get duplicates in vector
|
||||
#include <boost/range/algorithm_ext/erase.hpp> // remove duplicates in vectora
|
||||
#include <boost/algorithm/string/predicate.hpp> // find ip in file (string compare)
|
||||
#include "version.h" // Code::Blocks AutoVersioning
|
||||
|
||||
|
||||
/** \brief Some definitions
|
||||
|
@ -56,6 +55,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define STATUS "RCx [nod.oe7drt.com]"
|
||||
#define COPYRIGHT "Copyright (C)2015-2023 Dominic Reich"
|
||||
|
||||
#ifndef VERSION
|
||||
#define VERSION "0.0-noversion (check Makefile)"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_FILENAME "/etc/blacklist-ip"
|
||||
#define TMP_FILENAME "/tmp/blacklist"
|
||||
#define IPTABLES "/sbin/iptables"
|
||||
|
@ -295,9 +301,9 @@ inline bool fileExists(const string &name) {
|
|||
*/
|
||||
void printHelp(bool printAll)
|
||||
{
|
||||
cout << "blacklist " << Version::VERSION_STRING << ", ";
|
||||
cout << Version::STATUS << endl;
|
||||
cout << Version::COPYRIGHT << endl;
|
||||
cout << "blacklist " << VERSION << ", ";
|
||||
cout << STATUS << endl;
|
||||
cout << COPYRIGHT << endl;
|
||||
cout << "Usage: blacklist [options] <ip-address>" << endl;
|
||||
if(printAll == true)
|
||||
{
|
||||
|
|
5
build.sh
5
build.sh
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
g++ blacklist.cpp -o blacklist -O2 -pipe -fomit-frame-pointer -Wall -s -pie -fpie -lboost_system
|
||||
|
||||
#cp blacklist /usr/local/bin/
|
||||
cp blacklist /usr/local/sbin/blacklist
|
Loading…
Reference in a new issue