lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

 diff -r ../Downloads/dogfood-master/makefile dogfood-master/makefile
 < $(CC)  $(CFLAGS) -shared -o $@ -fPIC $+
> $(CC) $(CFLAGS) -bundle -undefined dynamic_lookup -o $@ $+

The flags to build the module on macOS are not accepted by GCC on Linux.
I will try to find a solution for it.

With the following diff the makefile should build for Linux and macOS.
I don´t know if there are exceptions for other platforms.
If someone has a suggestion, tell me about it so I can fix the makefile.

-- Jasper

@@ -3,6 +3,13 @@ CFLAGS = -Wall -Wextra -Wpedantic -O3
 INCLUDES = -I "./src"
 LDFLAGS = -llua

+OS = $(shell uname -s)
+ifeq ($(OS),Darwin)
+	LIB_FLAGS = -bundle -undefined dynamic_lookup
+	LIB_FLAGS = -shared -fPIC
 SRCDIR = src/
 OUTDIR = out/
 TSTDIR = test/
@@ -54,7 +61,7 @@ $(OUTDIR)foobar: $(OUTDIR)dogfood $(TSTDIR)foo.lua $(TSTDIR)bar.lua $(TSTDIR)bar
 	chmod u+x $@

 $(OUTDIR) $(TSTDIR)pg1003.c
-	$(CC)  $(CFLAGS) -shared -o $@ -fPIC $+
+	$(CC)  $(CFLAGS) $(LIB_FLAGS) -o $@ $+

 # By copying to we have created an invalid lua library (wrong entry point) that is used to test dogfood