Skip to content

Commit 823ece5

Browse files
committed
update makefile for macOS
1 parent eebd668 commit 823ece5

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

Makefile

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
1-
CFLAGS = -fPIC -O3 -Wall -std=c99 -pedantic
2-
CFLAGS += $(INC)
3-
41
INC = -Isrc
52

63
ifdef LUAPATH
74
INC += -I$(LUAPATH)
85
endif
96

10-
LFLAGS = -shared
7+
UNAME_S := $(shell uname -s)
118

12-
NEWT_SRC = src/luanewt.c src/luanewt.h
13-
NEWT_SO = newt.so
14-
NEWT_LIB = -lnewt
9+
ifeq ($(UNAME_S), Darwin)
10+
INC += -I/usr/local/include
11+
NEWT_LIB = -L/usr/local/lib -lnewt
12+
SHARED_LIB = -dynamiclib -Wl,-undefined,dynamic_lookup
13+
else
14+
NEWT_LIB = -lnewt
15+
SHARED_LIB = -shared
16+
endif
1517

18+
CFLAGS = -fPIC -O3 -Wall -std=c99 -pedantic
19+
CFLAGS += $(INC)
20+
21+
NEWT_SO = newt.so
1622

1723
all: $(NEWT_SO)
1824

19-
$(NEWT_SO): $(NEWT_SRC)
20-
$(CC) $(LFLAGS) -o $@ $(CFLAGS) $< $(NEWT_LIB)
25+
$(NEWT_SO): src/luanewt.c src/luanewt.h
26+
$(CC) $(SHARED_LIB) -o $@ $(CFLAGS) $< $(NEWT_LIB)
2127

2228
clean:
2329
$(RM) $(NEWT_SO)

readme.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# a newt binding library for Lua 5.3
22

3-
this is a simple [newt][newt] binding library for lua 5.3,
4-
it is fork from [luanewt][luanewt].
3+
This is a simple [newt][newt] binding library for lua 5.3, fork from [luanewt][luanewt].
4+
5+
It has been tested only on Mac OS X and Centos 6.
6+
7+
## build
8+
9+
1. install deps
10+
11+
MacOS: `brew install newt`
12+
CentOS: `yum install -y newt-devel`
13+
14+
2. make
515

616
## TODO
717

0 commit comments

Comments
 (0)