forked from processone/fast_xml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.mix
53 lines (39 loc) · 1.2 KB
/
Makefile.mix
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
# This file is used to compile C NIF module in Elixir buildchain
MIX = mix
CFLAGS = -g -O2 -Wall
#CFLAGS = -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter
ERLANG_PATH = $(shell erl -eval 'io:format("~s", [lists:concat([code:root_dir(), "/erts-", erlang:system_info(version), "/include"])])' -s init stop -noshell)
ERL_INTERFACE_PATH = $(shell erl -eval 'io:format("~s", [code:lib_dir(erl_interface, lib)])' -s init stop -noshell)
CFLAGS += -I$(ERLANG_PATH)
LDFLAGS += -lexpat
ifneq ($(OS),Windows_NT)
CFLAGS += -fPIC
ifeq ($(shell uname),Darwin)
LDFLAGS += -dynamiclib -undefined dynamic_lookup
endif
ifeq ($(shell uname),FreeBSD)
CFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib
endif
ifeq ($(shell uname),Linux)
LDFLAGS += -shared -L$(ERL_INTERFACE_PATH) -lerl_interface -lei
endif
endif
.PHONY: all fast_xml clean
all: fast_xml
fast_xml:
$(MIX) compile
c_src/%.o: c_src/%.c
$(CC) -c $(CFLAGS) -o $@ $<
priv/lib/%.so:
@mkdir -p priv/lib
$(CC) $< $(LDFLAGS) -o $@
priv/lib/fxml_stream.so: c_src/fxml_stream.o
priv/lib/fxml.so: c_src/fxml.o
clean:
$(RM) priv/lib/fxml_stream.so
$(RM) priv/lib/fxml.so
# Local Variables:
# mode: makefile
# End:
# vim: set filetype=makefile