aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2023-05-08 21:17:10 -0500
committerAlexander M Pickering <alex@cogarr.net>2023-05-08 21:17:10 -0500
commite39f4f502452b5d0d75d88e5397543e3e90213a8 (patch)
treef615ffe4c0f9ea76b6e6d7e5ab250292f6c0ea43
parent41a2834903c541ff28a647836fda323e06b192a7 (diff)
downloadlua-nng-e39f4f502452b5d0d75d88e5397543e3e90213a8.tar.gz
lua-nng-e39f4f502452b5d0d75d88e5397543e3e90213a8.tar.bz2
lua-nng-e39f4f502452b5d0d75d88e5397543e3e90213a8.zip
Allow appending to cflags
-rw-r--r--Makefile16
-rw-r--r--src/lua-nng-aio.c1
2 files changed, 10 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index a76de2d..e10c227 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,25 @@
CC?=gcc
LIBS?=-lnng
+ALL_CFLAGS=$(CFLAGS)
+ALL_LDFLAGS=$(LDFLAGS)
ifdef NNG_LIBDIR
- LDFLAGS+= -L$(NNG_LIBDIR)
+ ALL_LDFLAGS+= -L$(NNG_LIBDIR)
endif
ifdef LUA_LIBDIR
- LDFLAGS+= -L$(LUA_LIBDIR)
+ ALL_LDFLAGS+= -L$(LUA_LIBDIR)
endif
ifdef LUA_LIB
LIBS+= -l$(LUA_LIB)
endif
ifdef NNG_INCDIR
- CFLAGS+= -I$(NNG_INCDIR)
+ ALL_CFLAGS+= -I$(NNG_INCDIR)
endif
ifdef LUA_INCDIR
- CFLAGS+= -I$(LUA_INCDIR)
+ ALL_CFLAGS+= -I$(LUA_INCDIR)
endif
ifeq ($(OS), Windows_NT)
- LDFLAGS+=-mwindows
+ ALL_LDFLAGS+=-mwindows
LIBS+=-lws2_32
endif
@@ -32,14 +34,14 @@ installed_target=$(target:bin/%=$(INST_LIBDIR)/%)
all: $(target)
$(target) : $(obj_files)
- $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+ $(CC) $(ALL_LDFLAGS) -o $@ $^ $(LIBS)
$(installed_target) : $(target)
$(MKDIR) -p $(@D)
$(CP) $< $@
$(obj_files): build/%.o : src/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(ALL_CFLAGS) -c -o $@ $<
install: $(installed_target)
diff --git a/src/lua-nng-aio.c b/src/lua-nng-aio.c
index beedbff..cead546 100644
--- a/src/lua-nng-aio.c
+++ b/src/lua-nng-aio.c
@@ -1,4 +1,5 @@
#include <stdlib.h>
+
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>