blob: f0752829e3aa7968636a4cf0f1141ced00aab174 [file] [log] [blame]
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +01001DESTDIR =
2PREFIX = /usr/local
3BINDIR = $(PREFIX)/bin
4
5CC = gcc
6LD = $(CC)
7
8CFLAGS = -g -O2 -Wall -Werror -pthread
9LDFLAGS = -lpthread
10
11OBJS = spoa.o
12
Thierry FOURNIER6908c952018-02-23 15:20:55 +010013ifneq ($(USE_LUA),)
14OBJS += ps_lua.o
15ifneq ($(LUA_INC),)
16CFLAGS += -I$(LUA_INC)
17endif
18ifneq ($(LUA_LIB),)
19LDLIBS += -L$(LUA_LIB)
20endif
21LDLIBS += -ldl -Wl,--export-dynamic -llua -lm -Wl,--no-export-dynamic
22endif
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010023
Thierry FOURNIER00a02252018-02-25 20:59:57 +010024ifneq ($(USE_PYTHON),)
25OBJS += ps_python.o
26CFLAGS += -I/usr/include/python2.7
27LDLIBS += -lpython2.7
28endif
29
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010030spoa: $(OBJS)
Thierry FOURNIER6908c952018-02-23 15:20:55 +010031 $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010032
33install: spoa
34 install spoa $(DESTDIR)$(BINDIR)
35
36clean:
37 rm -f spoa $(OBJS)
38
39%.o: %.c
40 $(CC) $(CFLAGS) -c -o $@ $<