-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
43 lines (30 loc) · 822 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
OS := $(shell uname)
SRC := entities.c
OBJ := $(SRC:.c=.o)
DEMO := demo
ifeq ($(OS), Darwin)
SO_NAME := libhtmlentities.dylib
else
SO_NAME := libhtmlentities.so
endif
CFLAGS := -Wall -O3 -flto -g -fPIC -MMD
ifeq ($(OS), Linux)
CFLAGS := $(CFLAGS) -Wl,--build-id
endif
PREFIX := /usr/local
LUA_VERSION = 5.1
SO_TARGET_DIR := $(PREFIX)/lib/lua/$(LUA_VERSION)
LUA_TARGET_DIR := $(PREFIX)/share/lua/$(LUA_VERSION)/
.PHONY = all test clean install
all : $(SO_NAME)
${OBJ} : %.o : %.c
$(CC) $(CFLAGS) -DBUILDING_SO -c $<
${SO_NAME} : ${OBJ}
$(CC) $(CFLAGS) -DBUILDING_SO $^ -shared -o $@
test: all
luajit test.lua
clean:
rm -f *.o *.so a.out *.d
install:
install -D -m 755 $(SO_NAME) $(DESTDIR)/$(SO_TARGET_DIR)/$(SO_NAME)
install -D -m 664 htmlentities.lua $(DESTDIR)/$(LUA_TARGET_DIR)/htmlentities.lua