-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
53 lines (35 loc) · 1.07 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
version=0.01
name=lua-iso8583-parser
dist=$(name)-$(version)
LUA_VERSION = 5.1
TARGET = iso8583.so
## Linux/BSD
CC = gcc
PREFIX ?= /usr/local
PREFIX = /usr/local
CFLAGS = -O3 -Wall -pedantic -DNDEBUG -g
CISO8583_CFLAGS = -fpic
CISO8583_LDFLAGS = -shared
LUA_INCLUDE_DIR ?= $(PREFIX)/include
LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION)
LUA_INCLUDE_DIR ?= $(PREFIX)/include
LUA_CMODULE_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION)
LUA_MODULE_DIR ?= $(PREFIX)/share/lua/$(LUA_VERSION)
LUA_BIN_DIR ?= $(PREFIX)/bin
BUILD_CFLAGS = -I$(LUA_INCLUDE_DIR) $(CISO8583_CFLAGS)
OBJS = iso8583.o luaiso8583.o
INSTALL ?= install
.PHONY: all clean dist test t
all: $(TARGET)
.c.o:
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(BUILD_CFLAGS) -o $@ $<
$(TARGET):$(OBJS)
$(CC) $(LDFLAGS) $(CISO8583_LDFLAGS) -o $@ $(OBJS)
test: all
install: $(TARGET)
mkdir -p $(DESTDIR)$(LUA_CMODULE_DIR)
rm -f $(DESTDIR)$(LUA_CMODULE_DIR)/$(TARGET)
cp $(TARGET) $(DESTDIR)$(LUA_CMODULE_DIR)
chmod $(EXECPERM) $(DESTDIR)$(LUA_CMODULE_DIR)/$(TARGET)
clean:
rm -f *.so $(TARGET) $(OBJS)