From 41a2834903c541ff28a647836fda323e06b192a7 Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Mon, 8 May 2023 20:22:22 -0500 Subject: LD is not actually defined for makefiles See https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html --- Makefile | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 379442e..a76de2d 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,24 @@ CC?=gcc -CAFLAGS+=-I$(NNG_INCDIR) -I$(LUA_INCDIR) -L$(LUA_LIBDIR) $(CFLAGS) -LADFLAGS+=$(LIBFLAG) $(LDFLAGS) -LIBS=-lnng +LIBS?=-lnng ifdef NNG_LIBDIR - LADFLAGS+= -L$(NNG_LIBDIR) + LDFLAGS+= -L$(NNG_LIBDIR) endif ifdef LUA_LIBDIR - LADFLAGS+= -L$(LUA_LIBDIR) + LDFLAGS+= -L$(LUA_LIBDIR) endif ifdef LUA_LIB LIBS+= -l$(LUA_LIB) endif -LD=gcc +ifdef NNG_INCDIR + CFLAGS+= -I$(NNG_INCDIR) +endif +ifdef LUA_INCDIR + CFLAGS+= -I$(LUA_INCDIR) +endif ifeq ($(OS), Windows_NT) LDFLAGS+=-mwindows LIBS+=-lws2_32 -else endif @@ -30,14 +32,14 @@ installed_target=$(target:bin/%=$(INST_LIBDIR)/%) all: $(target) $(target) : $(obj_files) - $(LD) $(LADFLAGS) -o $@ $^ $(LIBS) + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(installed_target) : $(target) $(MKDIR) -p $(@D) $(CP) $< $@ $(obj_files): build/%.o : src/%.c - $(CC) $(CAFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) -c -o $@ $< install: $(installed_target) -- cgit v1.2.3-70-g09d2