aboutsummaryrefslogtreecommitdiff
path: root/test/postinstall/cpp_app/makefile.mak
diff options
context:
space:
mode:
authorMike Taves <mwtoews@gmail.com>2021-12-09 00:45:03 +1300
committerGitHub <noreply@github.com>2021-12-09 00:45:03 +1300
commit7a9b6566ac02d8c408f4f3758bfa5fcc3e90b552 (patch)
treed71d0771cc9f95d5a8ea96bd975bbd4164188813 /test/postinstall/cpp_app/makefile.mak
parent1b18defb63c7d2420d18e4375348663874247838 (diff)
downloadPROJ-7a9b6566ac02d8c408f4f3758bfa5fcc3e90b552.tar.gz
PROJ-7a9b6566ac02d8c408f4f3758bfa5fcc3e90b552.zip
Refactor post-install suite to test shared and static projlib (#2972)
Diffstat (limited to 'test/postinstall/cpp_app/makefile.mak')
-rw-r--r--test/postinstall/cpp_app/makefile.mak34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/postinstall/cpp_app/makefile.mak b/test/postinstall/cpp_app/makefile.mak
new file mode 100644
index 00000000..8d84785f
--- /dev/null
+++ b/test/postinstall/cpp_app/makefile.mak
@@ -0,0 +1,34 @@
+PROGRAM = cpp_app
+OBJECTS = $(addsuffix .o,$(PROGRAM))
+TESTS = \
+ test_ldd.sh \
+ test_transform.sh \
+ test_searchpath.sh \
+ test_version.sh
+
+override CXXFLAGS += -std=c++11 -fvisibility=hidden -g -Wall -Werror $(shell pkg-config proj --cflags)
+
+ifeq ($(BUILD_MODE),static)
+ UNAME_S := $(shell uname -s)
+ _ldflags := $(shell pkg-config proj --libs --static)
+ ifeq ($(UNAME_S),Linux)
+ # force static linking to libproj
+ _ldflags := $(shell echo $(_ldflags) | sed 's/-lproj/-Wl,-Bstatic -lproj -Wl,-Bdynamic/')
+ endif
+ override LDFLAGS += $(_ldflags)
+else # default is shared
+ override LDFLAGS += $(shell pkg-config proj --libs)
+endif
+
+all: $(PROGRAM)
+
+$(PROGRAM): $(OBJECTS)
+ $(CXX) -o $@ $< $(LDFLAGS)
+
+test: $(PROGRAM)
+ set -e; for t in $(TESTS); do ./$$t; done
+
+clean:
+ $(RM) $(PROGRAM) $(OBJECTS)
+
+.PHONY: test clean