This repository has been archived by the owner on Dec 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
58 lines (42 loc) · 1.49 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
57
58
include lualib.mk
SASS_CFLAGS ?= $(shell $(PKGCONFIG) --cflags libsass)
SASS_LDFLAGS ?= $(shell $(PKGCONFIG) --libs-only-L libsass)
SASS_LDLIBS ?= $(or $(shell $(PKGCONFIG) --libs-only-l libsass), -lsass)
CFLAGS ?= -g -O2 -Wall -Wextra -Wwrite-strings -Wshadow -Werror=c90-c99-compat
XCFLAGS += -std=c99 -pedantic -fPIC -fvisibility=hidden
XCFLAGS += $(LUA_CFLAGS) $(SASS_CFLAGS)
XLDFLAGS += $(SASS_LDFLAGS) $(SASS_LDLIBS)
default:
@echo 'The Makefile is for development only.' >&2
@echo 'Use "luarocks make" to install.' >&2
all: sass.so
sass.o: compat.h
install: all
$(MKDIR) '$(DESTDIR)$(LUA_CMOD_DIR)'
$(INSTALLX) sass.so '$(DESTDIR)$(LUA_CMOD_DIR)/sass.so'
uninstall:
$(RM) '$(DESTDIR)$(LUA_CMOD_DIR)/sass.so'
lua-sass-%.tar.gz:
git archive --prefix=lua-sass-$*/ -o $@ $*
# Ensure the tests only load modules from within the current directory
export LUA_PATH = ./?.lua
export LUA_CPATH = ./?.so
check: all test.lua
@$(LUA) test.lua
check-compat:
$(MAKE) -sB check LUA_PC=luajit
$(MAKE) -sB check CC=clang
$(MAKE) -sB check
check-install: DESTDIR = TMP
check-install: export LUA_PATH =
check-install: export LUA_CPATH = $(DESTDIR)$(LUA_CMOD_DIR)/?.so
check-install: install check uninstall
rmdir -p "$(DESTDIR)$(LUA_CMOD_DIR)"
githooks: .git/hooks/pre-commit
.git/hooks/pre-commit: Makefile
printf '#!/bin/sh\n\nmake -s check || exit 1' > $@
chmod +x $@
clean:
$(RM) sass.so sass.o lua-sass-*.tar.gz
.PHONY: default all install uninstall githooks clean
.PHONY: check check-compat check-install