43 lines
1.7 KiB
Diff
43 lines
1.7 KiB
Diff
--- Makefile.orig 2013-04-23 09:56:44.031317155 +0200
|
|
+++ Makefile 2013-04-23 10:01:52.126993442 +0200
|
|
@@ -17,7 +17,9 @@
|
|
# -DUSE_LUA - embed Lua in Mongoose (+100kb)
|
|
|
|
PROG = mongoose
|
|
-CFLAGS = -std=c99 -O2 -W -Wall -pedantic -pthread $(COPT)
|
|
+LIB = lib$(PROG).so.0
|
|
+CFLAGS += -std=c99 -O2 -W -Wall -pedantic -pthread $(COPT)
|
|
+
|
|
|
|
# To build with Lua, download and unzip Lua 5.2.1 source code into the
|
|
# mongoose directory, and then add $(LUA_SOURCES) to CFLAGS
|
|
@@ -79,7 +81,9 @@ all:
|
|
# "-Wl,--as-needed" turned on by default in cc command.
|
|
# Also, this is turned in many other distros in static linkage builds.
|
|
linux:
|
|
- $(CC) mongoose.c main.c -o $(PROG) -ldl $(CFLAGS)
|
|
+ $(CC) mongoose.c -shared -fPIC -fpic -Wl,-soname,$(LIB) \
|
|
+ -o $(LIB) -ldl -lpthread $(CFLAGS)
|
|
+ $(CC) main.c -o $(PROG) -ldl -lpthread -L. $(LIB) $(CFLAGS)
|
|
|
|
mac: bsd
|
|
bsd:
|
|
@@ -94,6 +98,18 @@ bsd_yassl:
|
|
solaris:
|
|
$(CC) mongoose.c main.c -lnsl -lsocket -o $(PROG) $(CFLAGS)
|
|
|
|
+install:
|
|
+ install -d $(DESTDIR)$(PREFIX)/include
|
|
+ install -m644 mongoose.h $(DESTDIR)$(PREFIX)/include
|
|
+ install -d $(DESTDIR)$(PREFIX)/bin
|
|
+ install -m755 $(PROG) $(DESTDIR)$(PREFIX)/bin
|
|
+ install -d $(DESTDIR)$(PREFIX)/lib
|
|
+ ln -sf $(LIB) $(LIB).0; cp -a $(LIB).0 $(DESTDIR)$(PREFIX)/lib
|
|
+ ln -sf $(LIB) libmongoose.so; cp -a libmongoose.so $(DESTDIR)$(PREFIX)/lib
|
|
+ install -m755 $(LIB) $(DESTDIR)$(PREFIX)/lib
|
|
+ install -d $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
|
|
+ -install -m644 mongoose.1 $(DESTDIR)$(PREFIX)/$(MANDIR)/man1
|
|
+
|
|
# For codesign to work in non-interactive mode, unlock login keychain:
|
|
# security unlock ~/Library/Keychains/login.keychain
|
|
# See e.g. http://lists.apple.com/archives/apple-cdsa/2008/Jan/msg00027.html
|