p≡p JSON adapter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

73 lines
2.6 KiB

# Copyright 2017 pEp Security SA
#
# This file is part of pEp JSON Server Adapter.
#
# pEp JSON Server Adapter is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License, version 3, as published by the Free Software Foundation.
#
# pEp JSON Server Adapter is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with pEp JSON Server Adapter. If not, see <http://www.gnu.org/licenses/>.
include Makefile.conf
# Order does matter, hence I have to split it for static builds:
LIBS1 = -levent -lpEpEngine -lasn1 -luuid -lgpgme -letpan
LIBS2 = -lpthread -lz -ldl
BUILD_ON = $(shell uname)
BUILD_FOR = $(BUILD_ON)
ifeq ($(BUILD_ON),Darwin)
ifeq ($(BUILD_FOR),Darwin)
CXXFLAGS += -I/opt/local/include -I$(HOME)/include -Ijson_spirit
LDFLAGS += -L/opt/local/lib -L$(HOME)/lib $(LIBS1) -lboost_system-mt -lboost_filesystem-mt -lboost_program_options-mt -lboost_thread-mt $(LIBS2)
endif
else
CXXFLAGS += -I$(HOME)/include -I$(HOME)/local/include/ -Ijson_spirit
LDFLAGS += -L$(HOME)/lib -L$(HOME)/local/lib $(LIBS1) -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread $(LIBS2)
endif
.PHONY: all
all: pep-json-server servertest
pep-json-server: main.o libjson-adapter.a
$(CXX) -o $@ $^ $(LDFLAGS)
pep-json-server-static: main.o libjson-adapter.a
$(CXX) -static -o $@ $^ $(LDFLAGS)
servertest: servertest.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
# FIXME How about `%.o json_spirit/*.o`? How about using built-in rules?
libjson-adapter.a: \
json_spirit/json_spirit_reader.o json_spirit/json_spirit_value.o json_spirit/json_spirit_writer.o \
json-adapter.o registry.o nfc.o json_rpc.o \
function_map.o pep-types.o \
gpg_environment.o \
security-token.o \
nfc_sets.o base64.o \
nulllogger.o \
prefix-config.o \
daemonize.o
ar rcs $@ $^
prefix-config.cc: Makefile
echo '// This file is generated by make. Edit the Makefile, not this file!\n#include "prefix-config.hh" \nconst char* const html_directory = "'$(HTML_DIRECTORY)'";\n' > $@
%.o : %.cc %.hh Makefile
$(CXX) $(CXXFLAGS) -c $<
.PHONY: install
install:
mkdir -v -p $(HTML_DIRECTORY)
cp -v ../html/* $(HTML_DIRECTORY)
# FIXME Install binaries as well here
.PHONY: clean
clean:
rm -vf pep-json-server servertest
rm -vf *.o
rm -vf prefix-config.cc
rm -vf json_spirit/*.o
rm -vf *.a