From 57145068575611ee2d0c0fdcf9b40a4d36f99933 Mon Sep 17 00:00:00 2001 From: Robert Manner Date: Sat, 2 Jun 2018 19:18:06 +0200 Subject: [PATCH] Makefile: make it work on osx References: jira PAM-7155 --- Makefile | 3 +++ Makefile.darwin | 11 +++++++++++ Makefile.tail | 2 +- tests/Makefile.darwin | 20 ++++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Makefile.darwin create mode 100644 tests/Makefile.darwin diff --git a/Makefile b/Makefile index fe3f772..c76d611 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,9 @@ win32-%: linux-%: $(MAKE) $(MFLAGS) -f Makefile.linux $* +darwin-%: + $(MAKE) $(MFLAGS) -f Makefile.darwin $* + clean: linux-clean win32-clean distclean: linux-distclean win32-distclean diff --git a/Makefile.darwin b/Makefile.darwin new file mode 100644 index 0000000..2fcd744 --- /dev/null +++ b/Makefile.darwin @@ -0,0 +1,11 @@ +include Makefile.head + +TARGET_OS=darwin + +CFLAGS = $(CFLAGS_COMMON) -I./unix -fPIC + +TARGET=libtermcapparser.dylib + +C_OBJS = $(C_OBJS_COMMON) unix/uxmisc.c unix/uxucs.c + +include Makefile.tail diff --git a/Makefile.tail b/Makefile.tail index 4180c9b..5d7192d 100644 --- a/Makefile.tail +++ b/Makefile.tail @@ -18,7 +18,7 @@ install: $(TARGET) mkdir -p $(DESTDIR)$(libdir) mkdir -p $(DESTDIR)$(incdir)/$(HEADER_DIR) $(INSTALL) -m 755 $(TARGET) $(DESTDIR)$(libdir)/$(TARGET) - $(INSTALL) -m 644 $(HEADERS) -t $(DESTDIR)$(incdir)/$(HEADER_DIR) + $(INSTALL) -m 644 $(HEADERS) $(DESTDIR)$(incdir)/$(HEADER_DIR) uninstall: rm -f $(DESTDIR)$(libdir)/$(TARGET) diff --git a/tests/Makefile.darwin b/tests/Makefile.darwin new file mode 100644 index 0000000..a117fcb --- /dev/null +++ b/tests/Makefile.darwin @@ -0,0 +1,20 @@ +CXXFLAGS= -I$(PREFIX)/include -O0 -g -Wall -I.. +LDFLAGS = -L$(PREFIX)/lib -ltermcapparser -L/usr/lib -lgmock -lgtest -lpthread +OBJECTS = test.o cell.o row.o state.o palette.o termcapparser.o + +all: test runtest + +.PHONY: +runtest: test + mkdir -p ../logs + DYLD_LIBRARY_PATH=$(PREFIX)/lib:${DYLD_LIBRARY_PATH} ./test --gtest_output=xml:../logs/tests-darwin.xml + +.PHONY: +clean: + rm -f $(OBJECTS) test + +test: $(OBJECTS) + $(CXX) -o test $(OBJECTS) $(LDFLAGS) + +%.o: %.cc + $(CXX) -c -o $@ $< $(CXXFLAGS)