screensaver/Makefile

68 lines
1.3 KiB
Makefile
Raw Normal View History

2020-10-24 17:57:45 +02:00
BIN := $(shell basename $$(pwd))
2020-10-27 15:27:46 +01:00
PLUGINS := rect
2020-10-24 17:57:45 +02:00
MANSECTION := 1
MANPAGE := $(BIN).$(MANSECTION)
SRCS := $(wildcard *.cpp)
OBJS := $(subst .cpp,.o,$(SRCS))
DEPS := $(subst .cpp,.d,$(SRCS))
CXX ?= g++
PKG_CONFIG ?= pkg-config
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
CONFIGDIR ?= $(PREFIX)/etc
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(DATADIR)/man/man
DOCDIR ?= $(DATADIR)/$(BIN)/doc
RM := /bin/rm -f
INSTALL := /usr/bin/install -c
CXXFLAGS := $(CXXFLAGS) -Wshadow -Wall -Wpedantic -Wextra -g -fno-strict-aliasing -std=c++17 -pthread
ifeq ($(DEBUG),1)
CXXFLAGS += -D DEBUG -O0
else
CXXFLAGS += -D NDEBUG -O3
endif
2020-10-27 15:27:46 +01:00
LDLIBS := -lm -lpthread -lscgui -lSDL2 -lcairo -lscerror -lscstring
2020-10-24 17:57:45 +02:00
2020-10-27 15:27:46 +01:00
.PHONY: all clean install modules
2020-10-24 17:57:45 +02:00
2020-10-27 15:27:46 +01:00
all: $(BIN) $(PLUGINS)
2020-10-24 17:57:45 +02:00
$(BIN): $(OBJS) $(DEPS)
$(CXX) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $(BIN)
%.o: %.cpp %.d Makefile
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
-include *.d
%.d: ;
2020-10-27 15:27:46 +01:00
modules: $(PLUGINS)
mkdir -p plugins
@for plug in $(PLUGINS) ;\
do \
cd $$plug && $(MAKE) && $(MAKE) install ;\
cd .. ;\
done
2020-10-24 17:57:45 +02:00
clean:
$(RM) $(OBJS) $(DEPS) $(BIN)
2020-10-27 15:27:46 +01:00
$(RM) -r plugins
@for plug in $(PLUGINS) ;\
do \
$(MAKE) -C $$plug clean ;\
done
2020-10-24 17:57:45 +02:00
install: $(BIN)
$(INSTALL) -d $(BINDIR)
$(INSTALL) $(BIN) $(BINDIR)
$(INSTALL) -d $(MANDIR)$(MANSECTION)
$(INSTALL) $(MANPAGE) $(MANDIR)$(MANSECTION)