summaryrefslogtreecommitdiff
path: root/speech_utils/Makefile
blob: 7bca179590640a45baf57dcb8129e3e5b8d1d970 (plain) (blame)
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
ifndef LUA_BINDIR
$(error Please build the package via luarocks: `luarocks make`)
endif

SHELL := /bin/bash
BUILD_DIR := $(CURDIR)/build
INC_PATH := $(LUA_BINDIR)/../include/
OBJS :=
LIBS :=
LUA_LIBS := init.lua
INCLUDE := -I $(LUA_INCDIR) -I $(INC_PATH) -DLUA_USE_APICHECK

SUBDIR := src
OBJ_DIR := $(BUILD_DIR)/objs
LUA_DIR = $(INST_LUADIR)/speech_utils

OBJS := $(addprefix $(OBJ_DIR)/,$(OBJS))
LIBS := $(addprefix $(INST_LIBDIR)/,$(LIBS))
OBJ_SUBDIR := $(addprefix $(OBJ_DIR)/,$(SUBDIR))
LUA_SUBDIR := $(addprefix $(LUA_DIR)/,$(SUBDIR))
LUA_LIBS := $(addprefix $(LUA_DIR)/,$(LUA_LIBS))
LIB_PATH := $(LUA_BINDIR)/../lib

build: $(OBJ_DIR) $(OBJ_SUBDIR) $(OBJS)
install: $(LUA_DIR) $(LUA_SUBDIR) $(LUA_LIBS) $(LIBS)

$(OBJ_DIR) $(LUA_DIR) $(OBJ_SUBDIR) $(LUA_SUBDIR):
	-mkdir -p $@
$(LUA_DIR)/%.lua: %.lua
	cp $< $@
$(OBJ_DIR)/%.o: %.c
	gcc -o $@ -c $< -g $(INCLUDE) -fPIC
clean:
	-rm $(OBJ_DIR)/src/*.o