[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Dogfood v1.0.2 has been released; an alternative for building self contained Lua executables
- From: "Jasper Klein" <jasper@...>
- Date: Thu, 27 Aug 2020 16:21:23 +0200
diff -r ../Downloads/dogfood-master/makefile dogfood-master/makefile
57c57
< $(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
+else
+ LIB_FLAGS = -shared -fPIC
+endif
+
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)pg1003.so: $(TSTDIR)pg1003.c
- $(CC) $(CFLAGS) -shared -o $@ -fPIC $+
+ $(CC) $(CFLAGS) $(LIB_FLAGS) -o $@ $+
# By copying pg1003.so to pg1005.so we have created an invalid lua library (wrong entry point) that is used to test dogfood
$(OUTDIR)pg1005.so: $(OUTDIR)pg1003.so