49 lines
2.0 KiB
Diff
49 lines
2.0 KiB
Diff
--- Makefile.orig 2012-06-19 09:55:56.512085441 +0200
|
|
+++ Makefile 2012-06-19 10:02:28.949545937 +0200
|
|
@@ -22,19 +22,20 @@ all:
|
|
### UNIX build: linux, bsd, mac, rtems
|
|
##########################################################################
|
|
|
|
-CFLAGS = -W -Wall -std=c99 -pedantic -O2 $(COPT)
|
|
+CFLAGS += -W -Wall -std=c99 -pedantic -O2 $(COPT)
|
|
MAC_SHARED = -flat_namespace -bundle -undefined suppress
|
|
-LINFLAGS = -ldl -pthread $(CFLAGS)
|
|
-LIB = _$(PROG).so
|
|
-CC = g++
|
|
+LINFLAGS += -ldl -pthread
|
|
+LIB ?= lib$(PROG).so.0
|
|
+CC ?= gcc
|
|
|
|
# Make sure that the compiler flags come last in the compilation string.
|
|
# If not so, this can break some on some Linux distros which use
|
|
# "-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 -shared -fPIC -fpic -o $(LIB) $(LINFLAGS)
|
|
- $(CC) mongoose.c main.c -o $(PROG) $(LINFLAGS)
|
|
+ $(CC) mongoose.c -shared -fPIC -fpic -Wl,-soname,$(LIB) \
|
|
+ -o $(LIB) $(LINFLAGS) $(CFLAGS)
|
|
+ $(CC) main.c -o $(PROG) $(LINFLAGS) -L. $(LIB) $(CFLAGS)
|
|
|
|
bsd:
|
|
$(CC) mongoose.c -shared -pthread -fpic -fPIC -o $(LIB) $(CFLAGS)
|
|
@@ -50,6 +51,18 @@ solaris:
|
|
gcc mongoose.c main.c -pthread -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
|
|
+
|
|
##########################################################################
|
|
### WINDOWS build: Using Visual Studio or Mingw
|
|
##########################################################################
|