-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (75 loc) · 2.29 KB
/
Makefile
File metadata and controls
92 lines (75 loc) · 2.29 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
include .config
UNAME ?= $(shell uname)
DESTDIR ?= /
PKG_CONFIG ?= pkg-config
INSTALL ?= install
RM ?= rm
LUA_IMPL ?= lua
LUA_BIN ?= $(LUA_IMPL)
LUA_CMODULE_DIR ?= $(shell $(PKG_CONFIG) --variable INSTALL_CMOD $(LUA_IMPL))
LIBDIR ?= $(shell $(PKG_CONFIG) --variable libdir $(LUA_IMPL))
LUA_INC ?= $(shell $(PKG_CONFIG) --variable includedir $(LUA_IMPL))
CC ?= cc
ifeq ($(UNAME), Linux)
OS_FLAGS ?= -shared
endif
ifeq ($(UNAME), Darwin)
OS_FLAGS ?= -bundle -undefined dynamic_lookup
endif
BIN = fann.so
OBJ = fann.o
INCLUDES = -I$(LUA_INC)
DEFINES =
LIBS = -L$(LIBDIR) -lfann
COMMONFLAGS = -O2 -g -std=c99 -pipe -fPIC $(OS_FLAGS)
LF = $(LIBS) $(COMMONFLAGS) $(LDFLAGS)
CF = -c $(INCLUDES) $(DEFINES) $(COMMONFLAGS) $(CFLAGS)
SRC = src/fann.c
HDR = src/fann.h
TEST_FLS = test/module.lua \
test/xor.data \
test/xortest.data
OTHER_FILES = Makefile \
.config \
README \
LICENSE \
TODO
DOCS = doc/luafann.html
VERSION = "Lua-FANN-0.3"
all: $(BIN)
$(BIN): $(OBJ)
$(CC) $(LF) $^ -o $@
%.o: src/%.c
$(CC) $(CF) -c $^ -o $@
clean:
$(RM) -f $(OBJ) $(BIN) test/*.net test/*.so $(DOCS)
docs: $(DOCS)
$(DOCS): $(SRC)
mkdir -p doc
$(LUA_BIN) doc.lua < $< > $@
test_dump_main: all
@echo "====== TEST: Dumping main FANN table ======"
$(LUA_BIN) -e 'fann=require"fann"; for k,v in pairs(fann) do print(k,v) end'
test: all
@echo "====== TEST: testing API ======"
-ln -sf ../$(BIN) test/
cd test && $(LUA_BIN) module.lua
dep:
makedepend $(DEFINES) -Y $(SRC) >/dev/null 2>&1
$(RM) -f Makefile.bak
install: all
$(INSTALL) -d $(DESTDIR)$(LUA_CMODULE_DIR)
$(INSTALL) $(BIN) $(DESTDIR)$(LUA_CMODULE_DIR)
uninstall: clean
cd $(LUA_CMODULE_DIR);
$(RM) -f $(BIN)
dist: $(VERSION).tar.gz
$(VERSION).tar.gz: $(SRC) $(TEST_FLS) $(OTHER_FILES)
@mkdir $(VERSION)
@mkdir $(VERSION)/src
@cp $(SRC) $(HDR) $(VERSION)/src
@mkdir $(VERSION)/test
@cp $(TEST_FLS) $(VERSION)/test
@cp $(OTHER_FILES) $(VERSION)
@tar -czf $(VERSION).tar.gz $(VERSION)
@$(RM) -rf $(VERSION)