Extend Makefile for cross-compiling

revert-43-persistence
Thomas Kupper 2019-03-23 13:18:48 +01:00 committed by Stefan Haustein
parent 9943deed2c
commit 9734ff585d
1 changed files with 14 additions and 7 deletions

View File

@ -1,15 +1,22 @@
CXX=g++
# set CXX to g++ if not set
CXX ?= g++
default: tiv
# append necessary arguments
override CPPFLAGS += -std=c++17 -Wall -fpermissive -fexceptions -O2
override LDFLAGS += -lstdc++fs -pthread -s
all: tiv
tiv.o: tiv.cpp CImg.h
$(CXX) -std=c++17 -Wall -fpermissive -fexceptions -O2 -c tiv.cpp -o tiv.o
$(CXX) $(CPPFLAGS) -c tiv.cpp -o $@
tiv : tiv.o
$(CXX) tiv.o -o tiv -lstdc++fs -pthread -s
$(CXX) $^ -o $@ $(LDFLAGS)
install: tiv
cp tiv /usr/local/bin/tiv
.PHONY: all install clean
install: all
test -d $(DESTDIR)/usr/local/bin || mkdir -p $(DESTDIR)/usr/local/bin
cp tiv $(DESTDIR)/usr/local/bin/tiv
clean:
rm -f tiv tiv.o
rm -f tiv tiv.o