/
makefile
56 lines (41 loc) · 1.19 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
ifneq ("$(origin V)", "command line")
Q = @
endif
LUA = lua
CC = $(CROSS_COMPILE)gcc
ECHO = @echo
DFB_INC_DIR = $(shell pkg-config --variable=includedir directfb)/directfb/
DFB_HEADER = $(DFB_INC_DIR)directfb_keyboard.h $(DFB_INC_DIR)directfb.h
CFLAGS = -Wall -fPIC $(shell pkg-config --cflags directfb $(LUA))
LDFLAGS = -shared $(shell pkg-config --libs directfb $(LUA))
# We might want to install the module to a different path
INSTALL_DIR ?= $(shell pkg-config --variable INSTALL_CMOD $(LUA))
COMPAT_DIR := compat/
SRC_DIR := src/
SRC := $(wildcard $(SRC_DIR)*.c $(COMPAT_DIR)*.c)
OBJ = $(SRC:.c=.o)
OUTPUT=directfb.so
$(OUTPUT): $(OBJ)
$(Q)$(ECHO) " LD "$@;
$(Q)$(CC) $^ $(LDFLAGS) -o $@
.c.o:
$(Q)$(ECHO) " CC "$@;
$(Q)$(CC) $(CFLAGS) -c $< -o $@
.gen.stamp: gendfb-lua.pl dir
$(Q)$(ECHO) "Generating from $(DFB_HEADER)"
$(Q)cat $(DFB_HEADER) | ./gendfb-lua.pl || exit 1
$(Q)touch .gen.stamp
tags: $(SRC_DIR)* $(DFB_HEADER)
$(Q)ctags $(SRC_DIR)* $(DFB_HEADER)
.PHONY: install
install: $(OUTPUT)
$(Q)mkdir -p $(INSTALL_DIR)
$(Q)cp $(OUTPUT) $(INSTALL_DIR)
.PHONY: clean
clean:
$(Q)rm -f *.so $(SRC_DIR)* .gen.stamp
.PHONY: gen
gen: .gen.stamp
.PHONY: dir
dir:
$(Q)mkdir -p src