Skip to content

Commit

Permalink
Makefile: make it work on osx
Browse files Browse the repository at this point in the history
References: jira PAM-7155
  • Loading branch information
manner82 authored and Imre Steiner committed Oct 8, 2018
1 parent 9cf7308 commit 5714506
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions Makefile.darwin
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Makefile.tail
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 20 additions & 0 deletions tests/Makefile.darwin
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 5714506

Please sign in to comment.