VERSION := 0.0.1 CXX ?= clang++ TARGET := kte OBJS := main.o AppendBuffer.o LIBS := PREFIX ?= $PREFIX MANDIR ?= $MANDIR CXXFLAGS += -Wall -Wextra -pedantic -Wshadow -Werror -std=c++17 -g CXXFLAGS += -Wno-unused-function CXXFLAGS += -DKE_VERSION="\"$(TARGET) version $(VERSION)\"" CXXFLAGS += OS_CFLAGS all: $(TARGET) ./$(TARGET) clean: -rm -f .?*.* *.core *.o *.html tags $(TARGET) $(OBJS) -rm -rf security -rm -rf $(TARGET)-$(VERSION) -rm -f $(TARGET)-$(VERSION).tgz $(TARGET): $(OBJS) ${CXX} -o $(TARGET) ${CXXFLAGS} ${LDFLAGS} $(LIBS) $(OBJS) install: $(TARGET) install -m 0755 $(TARGET) $(PREFIX)/bin/$(TARGET) install -m 0755 -d $(MANDIR)/man1 install -m 0444 $(TARGET).1 $(MANDIR)/man1/$(TARGET).1 uninstall: -rm -f $(PREFIX)/bin/$(TARGET) -rm -f $(MANDIR)/man1/$(TARGET).1 lint: make clean && scan-build make # -mkdir security # -rats -w 3 $(TARGET).[ch] > security/rats.out # -lint -fhrs $(TARGET).c > security/lint.out # -splint +posixlib $(TARGET).[ch] > security/splint.out dist: clean -mkdir $(TARGET)-$(VERSION) -cp * $(TARGET)-$(VERSION) -cd $(TARGET)-$(VERSION) && make distclean && cd .. -tar czf $(TARGET)-$(VERSION).tgz $(TARGET)-$(VERSION) distclean: clean -rm -f Makefile htmldoc: -mandoc -Thtml $(TARGET).1 > $(TARGET).1.html tags: ctags *.cc *.h .cc.o: $(CXX) -c ${CXXFLAGS} $? .PHONY: clean all install lint uninstall dist distclean htmldoc tags