diff --git a/Makefile b/Makefile index d2a1cd1..ad3e65f 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,8 @@ OBJS = $(shell find src -type f -iname '*.c' | sed 's/\(.*\)\.c$$/$(BUILD_DIR)\/ TARGET = $(BUILD_DIR)/$(PROJECT).so +LUA_CPATH = $(shell echo "$${PWD}/$(BUILD_DIR)/?.so;$${LUA_CPATH}") + ifdef CI CHECK_ARGS ?= --formatter TAP TEST_ARGS ?= --output=TAP @@ -50,6 +52,11 @@ TEST_ARGS ?= --output=TAP CCFLAGS += -Werror endif +bold := $(shell tput bold) +orange := $(shell tput setaf 7) +title := $(bold)$(orange) +reset := $(shell tput sgr0) + .PHONY: all clean doc doc-content doc-styles install uninstall test check rock all: build doc @@ -58,23 +65,23 @@ build: $(TARGET) $(BUILD_DIR)/%.o: %.c @mkdir -p $(shell dirname "$@") - @echo "\033[1;97m$(CC) $< -o $@\033[0m" + @echo "$(title)$(CC) $< -o $@$(reset)" @$(CC) -c $(CCFLAGS) $< -o $@ $(TARGET): $(OBJS) - @echo "\033[1;97m$(CC) -o $@\033[0m" + @echo "$(title)$(CC) -o $@$(reset)" @$(CC) $(LIBFLAG) -o $@ $(OBJS) $(LIBS) $(BUILD_DIR)/doc/index.html: @mkdir -p "$(BUILD_DIR)/doc" "$(BUILD_DIR)/src" - @echo "\033[1;97mPreprocess sources\033[0m" + @echo "$(title)Preprocess sources$(reset)" sh tools/process_docs.sh "$(BUILD_DIR)" - @echo "\033[1;97mGenerate documentation\033[0m" + @echo "$(title)Generate documentation$(reset)" ldoc --config=doc/config.ld --dir "$(BUILD_DIR)/doc" --project $(PROJECT) "$(BUILD_DIR)/src" $(BUILD_DIR)/doc/ldoc.css: doc/ldoc.scss @mkdir -p "$(BUILD_DIR)/doc" - @echo "\033[1;97mGenerate stylesheet\033[0m" + @echo "$(title)Generate stylesheet$(reset)" sass doc/ldoc.scss $(BUILD_DIR)/doc/ldoc.css doc-styles: $(BUILD_DIR)/doc/ldoc.css @@ -87,10 +94,10 @@ clean: rm -r out/ install: build doc - @echo "\033[1;97mInstall C library\033[0m" + @echo "$(title)Install C library\033[0m" install -vDm 644 -t $(INSTALL_LIBDIR) $(TARGET) - @echo "\033[1;97mInstall documentation\033[0m" + @echo "$(title)Install documentation\033[0m" install -vd $(INSTALL_DOCDIR) cp -vr $(BUILD_DIR)/doc/* $(INSTALL_DOCDIR) @@ -101,8 +108,11 @@ uninstall: check: @echo "Nothing to do" -test: +spec: build busted --config-file=.busted.lua --lua=$(LUA) $(TEST_ARGS) +test: build + $(LUA) test.lua + rock: luarocks --local --lua-version $(LUA_VERSION) make rocks/lua-libpulse-glib-scm-1.rockspec