-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
37 lines (31 loc) · 833 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
NAME=3mfthumb
SHELL=/bin/sh
PREFIX?=/usr
INSTALL_HOME=$(HOME)/.local
INSTALL_ROOT=$(PREFIX)/local
DESTDIR=$(INSTALL_HOME)
.SUFFIXES:.cpp .o
.PHONY: install clean
SRCS=$(wildcard *.cpp)
OBJS=$(SRCS:.cpp=.o)
CFLAGS?=-g -Wall -O2
BUILD_CFLAGS=$(shell pkg-config --cflags lib3mf)
LDFLAGS:=$(shell pkg-config --libs lib3mf)
ifeq ($(shell whoami), root)
DESTDIR:=$(INSTALL_ROOT)
endif
all: $(NAME)
%.o: %.cpp
$(CXX) $(BUILD_CFLAGS) $(CFLAGS) -c $< -o $@
$(NAME): $(OBJS)
$(CXX) $(CFLAGS) $(NAME).o -o $(NAME) $(LDFLAGS)
install:
$(info Installing to $(DESTDIR))
install -Ds $(NAME) $(DESTDIR)/bin/
install -D -m 644 3mf.thumbnailer $(DESTDIR)/share/thumbnailers/
$(RM) -rf $(HOME)/.cache/thumbnails/*
uninstall:
$(RM) $(DESTDIR)/bin/$(NAME)
$(RM) $(DESTDIR)/share/thumbnailers/3mf.thumbnailer
clean:
$(RM) *.o $(NAME)