From fddb43101fad2b926efc80409c9d41a9948665ec Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Sun, 30 Apr 2023 00:25:28 -0500 Subject: Update build rules --- Makefile | 11 ++++++++--- lua-nng-dev-1.rockspec | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c66fbe2..379442e 100644 --- a/Makefile +++ b/Makefile @@ -23,18 +23,23 @@ endif src_files=$(wildcard src/*.c) obj_files=$(src_files:src/%.c=build/%.o) target=bin/nng.$(LIB_EXTENSION) +installed_target=$(target:bin/%=$(INST_LIBDIR)/%) + +.PHONY: all install test clean all: $(target) $(target) : $(obj_files) - echo "Lua_lib is: $(LUA_LIB), libs are: $(LIBS)" $(LD) $(LADFLAGS) -o $@ $^ $(LIBS) +$(installed_target) : $(target) + $(MKDIR) -p $(@D) + $(CP) $< $@ + $(obj_files): build/%.o : src/%.c $(CC) $(CAFLAGS) -c -o $@ $< -install: $(target) - $(CP) $(target) $(INST_LIBDIR) +install: $(installed_target) test: busted --cpath=./bin/?$(SHARE_EXT) diff --git a/lua-nng-dev-1.rockspec b/lua-nng-dev-1.rockspec index 337941d..891d3bf 100644 --- a/lua-nng-dev-1.rockspec +++ b/lua-nng-dev-1.rockspec @@ -37,6 +37,7 @@ build = { NNG_LIBDIR="$(NNG_LIBDIR)", LUA_LIBDIR="$(LUA_LIBDIR)", LIB_EXTENSION="$(LIB_EXTENSION)", + MKDIR="$(MKDIR)", CP="$(CP)", }, } -- cgit v1.2.3-70-g09d2