changed to new STARTER design

This commit is contained in:
Bob Polis 2019-03-17 23:02:27 +01:00
parent 0a10d84248
commit 3788dd5753

View File

@ -1,35 +1,46 @@
CC=gcc
CXX=g++
RM=rm -f
CP=cp
MKDIR=mkdir -p
CXXFLAGS=-Wall -O2 -std=c++11
LDFLAGS=
LDLIBS=
BIN := ranlin
TOOL=ranlin
SRCS=main.cpp
OBJS=$(subst .cpp,.o,$(SRCS))
SRCS := main.cpp
OBJS := $(subst .cpp,.o,$(SRCS))
DEPS := $(subst .cpp,.d,$(SRCS))
all: $(TOOL)
CXX ?= g++
PKG_CONFIG ?= pkg-config
$(TOOL): $(OBJS)
$(CXX) $(LDFLAGS) -o $(TOOL) $(LDLIBS) $(OBJS)
PREFIX ?= /usr/local
BINDIR ?= ${PREFIX}/bin
DATADIR ?= ${PREFIX}/share
MANDIR ?= ${DATADIR}/man
depend: .depend
RM := /bin/rm -f
INSTALL := /usr/bin/install -c
.depend: $(SRCS)
$(RM) ./.depend
$(CXX) $(CXXFLAGS) -MM $^>>./.depend;
CXXFLAGS := ${CXXFLAGS} -Wshadow -Wall -Wpedantic -Wextra -g -fno-strict-aliasing -std=c++14 -pthread
ifeq ($(DEBUG),1)
CXXFLAGS += -D DEBUG -O0
else
CXXFLAGS += -O3
endif
LDLIBS := -lm -lpthread -lcommon
LDFLAGS :=
all: $(BIN)
$(BIN): $(OBJS) $(DEPS)
$(CXX) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $(BIN)
%.o: %.cpp %.d Makefile
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
-include *.d
%.d: ;
.PHONY: clean install
clean:
$(RM) $(OBJS)
$(RM) $(OBJS) $(DEPS) $(BIN)
dist-clean: clean
$(RM) *~ ./.depend $(TOOL)
install:
$(RM) ~/bin/$(TOOL)
$(CP) $(TOOL) ~/bin/
include .depend
install: $(BIN)
$(INSTALL) $(BIN) $(DESTDIR)$(BINDIR)