Makefile
author Volker Birk <vb@pep.foundation>
Wed, 24 Oct 2018 22:44:54 +0200
changeset 74 97a6eaa45278
parent 63 32fa30501e3d
child 85 c318ce6c21ed
permissions -rw-r--r--
merging
     1 # this file is under GNU GPL 3.0, see LICENSE.txt
     2 # see LICENSE.txt
     3 
     4 include Makefile.conf
     5 -include local.conf
     6 
     7 CXXFLAGS += -I$(HOME)/include -std=c++14 -O0 -g
     8 
     9 SOURCE=$(wildcard *.cc)
    10 HEADERS=$(wildcard *.hh *.hxx)
    11 OBJECTS=$(subst .cc,.o,$(SOURCE))
    12 WITHOUT_TESTS=$(patsubst test%.o,,$(OBJECTS))
    13 
    14 all: $(TARGET)
    15 
    16 %.o: %.cc %.hh
    17 	$(CXX) $(CXXFLAGS) -c $<
    18 
    19 $(TARGET): $(WITHOUT_TESTS)
    20 	ar -rc $@ $^
    21 
    22 .PHONY: clean distclean test install uninstall
    23 
    24 clean:
    25 	rm -f $(TARGET) $(OBJECTS) *.a test_adapter lib
    26 
    27 distclean: clean
    28 	rm -Rf .gnupg .pEp_management*
    29 
    30 test: test_adapter test_library
    31 ifeq ($(HOME),$(PREFIX))
    32 	-ln -fs $$HOME/lib
    33 endif
    34 	HOME=$$(pwd) ./test_adapter
    35 
    36 test_adapter: test_adapter.o $(TARGET)
    37 	$(CXX) -o $@ -L$(PEP)/lib -lpEpEngine -L. -lpEpAdapter $<
    38 
    39 test_library: test_library.o $(TARGET)
    40 	$(CXX) -o $@ -L$(PEP)/lib -lpEpEngine -L. -lpEpAdapter $<
    41 
    42 install: $(TARGET)
    43 	-mkdir -p $(PEP)/include/pEp
    44 	cp $(HEADERS) $(PEP)/include/pEp/
    45 	cp $(TARGET) $(PEP)/lib/
    46 
    47 uninstall:
    48 	cd $(PEP)/include && rm -f $(HEADERS)
    49 	cd $(PEP)/lib && rm -f $(TARGET)