-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (25 loc) · 688 Bytes
/
Makefile
File metadata and controls
34 lines (25 loc) · 688 Bytes
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
LDFLAGS ?= -ludev
CFLAGS = -O3 -pedantic -Wall
CC ?= $(CROSSCOMPILE)-gcc
ifneq ($(OS),Windows_NT)
CFLAGS += -fPIC
ifeq ($(shell uname),Darwin)
LDFLAGS += -dynamiclib -undefined dynamic_lookup
endif
endif
ifeq ($(ERL_INCLUDE_DIR),)
ERL_ROOT_DIR = $(shell erl -eval "io:format(\"~s~n\", [code:root_dir()])" -s init stop -noshell)
ifeq ($(ERL_ROOT_DIR),)
$(error Could not find Erlang installation.)
endif
ERL_INCLUDE_DIR = "$(ERL_ROOT_DIR)/usr/include"
endif
ERL_CFLAGS ?= -I$(ERL_INCLUDE_DIR)
.PHONY: all clean
all: clean priv priv/udev.so
priv:
mkdir -p priv
priv/udev.so: src/udev.c
$(CC) $^ $(ERL_CFLAGS) $(LDFLAGS) $(CFLAGS) -shared -o $@
clean:
$(RM) priv/udev.so