Skip to content

Commit 859c677

Browse files
committed
Add lcurl.a target to makefile.
This allows you to build a version of Lua-cURL which can be statically linked into other programs, making distribution much easier.
1 parent 5961cae commit 859c677

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Makefile

+9-1
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,22 @@ CF = $(INCLUDES) $(DEFINES) $(COMMONFLAGS) $(WARN) -DPTHREADS $(C
5454

5555
SCR = src/lua/*.lua src/lua/cURL/*.lua src/lua/cURL/impl/*.lua
5656
SRCS = src/*.c
57+
OBJS = $(subst src/,,$(subst .c,.o,$(SRCS)))
5758

5859
BIN = $(T).so
60+
STATIC_LIB = $(T).a
5961

6062
all: $(BIN)
6163

6264
$(BIN): $(SRCS)
6365
$(CC) $(CF) -o $@ $^ $(LF)
6466

67+
$(OBJS): $(SRCS)
68+
$(CC) $(CF) -c $^ $(LF)
69+
70+
$(STATIC_LIB): $(OBJS)
71+
ar rcs $@ $^
72+
6573
install: all
6674
$(INSTALL) -d $(DESTDIR)$(LUA_CMOD) $(DESTDIR)$(LUA_LMOD)/cURL/impl
6775
$(INSTALL) $(BIN) $(DESTDIR)$(LUA_CMOD)
@@ -71,4 +79,4 @@ install: all
7179
$(INSTALL) src/lua/cURL/impl/cURL.lua $(DESTDIR)$(LUA_LMOD)/cURL/impl
7280

7381
clean:
74-
$(RM) -f $(BIN)
82+
$(RM) -f $(BIN) $(OBJS) $(STATIC_LIB)

0 commit comments

Comments
 (0)