ranlin/Makefile

47 lines
763 B
Makefile
Raw Normal View History

2019-03-17 23:02:27 +01:00
BIN := ranlin
2018-01-23 13:17:40 +01:00
2019-03-17 23:02:27 +01:00
SRCS := main.cpp
OBJS := $(subst .cpp,.o,$(SRCS))
DEPS := $(subst .cpp,.d,$(SRCS))
2018-01-23 13:17:40 +01:00
2019-03-17 23:02:27 +01:00
CXX ?= g++
PKG_CONFIG ?= pkg-config
2018-01-23 13:17:40 +01:00
2019-03-17 23:02:27 +01:00
PREFIX ?= /usr/local
BINDIR ?= ${PREFIX}/bin
DATADIR ?= ${PREFIX}/share
MANDIR ?= ${DATADIR}/man
2018-01-23 13:17:40 +01:00
2019-03-17 23:02:27 +01:00
RM := /bin/rm -f
INSTALL := /usr/bin/install -c
2018-01-23 13:17:40 +01:00
CXXFLAGS := ${CXXFLAGS} -Wshadow -Wall -Wpedantic -Wextra -g -std=c++14
2019-03-17 23:02:27 +01:00
ifeq ($(DEBUG),1)
CXXFLAGS += -D DEBUG -O0
else
CXXFLAGS += -O3
endif
2018-01-23 13:17:40 +01:00
2020-04-12 22:17:50 +02:00
LDLIBS := -lm -lpthread
2019-03-17 23:02:27 +01:00
LDFLAGS :=
all: $(BIN)
$(BIN): $(OBJS) $(DEPS)
$(CXX) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $(BIN)
%.o: %.cpp %.d Makefile
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
2018-01-23 13:17:40 +01:00
2019-03-17 23:02:27 +01:00
-include *.d
2018-01-23 13:17:40 +01:00
2019-03-17 23:02:27 +01:00
%.d: ;
.PHONY: clean install
clean:
$(RM) $(OBJS) $(DEPS) $(BIN)
2018-01-23 13:17:40 +01:00
2019-03-17 23:02:27 +01:00
install: $(BIN)
$(INSTALL) $(BIN) $(DESTDIR)$(BINDIR)