Extend Makefile for cross-compiling
This commit is contained in:
parent
9943deed2c
commit
9734ff585d
1 changed files with 14 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue