You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
webserver/Makefile

71 lines
1.4 KiB
Makefile

-include local.conf
PREFIX?=$(HOME)
BOOST_INCLUDE?=/opt/local/include
BOOST_LIB?=/opt/local/lib
SIGNING_IDENTITY?=68AD28395D8090C2A8ACDD3A31FA6735C8DAE2F4
AR?=ar
CC?=cc
CXX?=c++
CFLAGS+=-std=c11
CXXFLAGS+=-I$(BOOST_INCLUDE) -std=c++11
LDFLAGS+=-L$(BOOST_LIB)
ifdef NDEBUG
CFLAGS+=-O3 -DNDEBUG
CXXFLAGS+=-O3 -DNDEBUG
else
CFLAGS+=-O0 -g
CXXFLAGS+=-O0 -g
endif
TARGET=libwebserver.a
ALL_SOURCE=$(filter-out test_%.cc,$(wildcard *.cc))
DEPENDS=$(subst .cc,.d,$(ALL_SOURCE))
ALL_OBJECTS=$(subst .d,.o,$(DEPENDS))
TEST_SOURCE=$(wildcard test_*.cc)
TEST_OBJECTS=$(subst .cc,.o,$(TEST_SOURCE))
TESTS=$(subst .cc,,$(TEST_SOURCE))
all: $(TARGET)
%.d: %.cc
@set -e; rm -f $@; \
$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
# If only the goal 'clean' is given, do not generate and include the '%.d' files.
ifneq ($(MAKECMDGOALS),clean)
-include $(DEPENDS)
endif
$(TARGET): $(ALL_OBJECTS)
$(AR) -cr $@ $^
%.o: %.cc
$(CXX) $(CXXFLAGS) -c -o $@ $^
test_%: test_%.o $(TARGET)
$(CXX) $(LDFLAGS) $(TARGET) -o $@ $<
test: $(TESTS)
for i in $(TESTS) ; do ./$$i ; done
.PHONY: clean uninstall install
install: $(TARGET)
mkdir -p $(PREFIX)/include/pEp
cp -f *.hh $(PREFIX)/include/pEp
uninstall:
for i in *.hh; do rm -f $(PREFIX)/include/pEp/\$i ; done
clean:
rm -f *.o *.d *.d.* $(TARGET) $(TESTS)