Makefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # $Id: Makefile,v 1.48 2008/12/18 17:46:13 nanard Exp $
  2. # MiniUPnP Project
  3. # http://miniupnp.free.fr/
  4. # (c) 2005-2007 Thomas Bernard
  5. # to install use :
  6. # $ PREFIX=/tmp/dummylocation make install
  7. # or
  8. # $ INSTALLPREFIX=/usr/local make install
  9. # or
  10. # make install (will go to /usr/bin, /usr/lib, etc...)
  11. CC ?= gcc
  12. #AR = gar
  13. #CFLAGS = -fPIC -O -Wall -g -DDEBUG
  14. CFLAGS ?= -fPIC -O -Wall -DNDEBUG
  15. INSTALL = install
  16. #following libs are needed on Solaris
  17. #LDLIBS=-lsocket -lnsl -lresolv
  18. # APIVERSION is used to build SONAME
  19. APIVERSION = 4
  20. SRCS = igd_desc_parse.c miniupnpc.c minixml.c minisoap.c miniwget.c \
  21. upnpc.c upnpcommands.c upnpreplyparse.c testminixml.c \
  22. minixmlvalid.c testupnpreplyparse.c minissdpc.c \
  23. upnperrors.c testigddescparse.c
  24. LIBOBJS = miniwget.o minixml.o igd_desc_parse.o minisoap.o \
  25. miniupnpc.o upnpreplyparse.o upnpcommands.o minissdpc.o \
  26. upnperrors.o
  27. OBJS = $(patsubst %.c,%.o,$(SRCS))
  28. # HEADERS to install
  29. HEADERS = miniupnpc.h miniwget.h upnpcommands.h igd_desc_parse.h \
  30. upnpreplyparse.h upnperrors.h declspec.h
  31. LIBRARY = libminiupnpc.a
  32. SHAREDLIBRARY = libminiupnpc.so
  33. SONAME = $(SHAREDLIBRARY).$(APIVERSION)
  34. EXECUTABLES = upnpc-static upnpc-shared \
  35. testminixml minixmlvalid testupnpreplyparse \
  36. testigddescparse
  37. INSTALLPREFIX ?= $(PREFIX)/usr
  38. INSTALLDIRINC = $(INSTALLPREFIX)/include/miniupnpc
  39. INSTALLDIRLIB = $(INSTALLPREFIX)/lib
  40. INSTALLDIRBIN = $(INSTALLPREFIX)/bin
  41. .PHONY: install clean depend all installpythonmodule
  42. all: validateminixml $(LIBRARY) $(EXECUTABLES)
  43. pythonmodule: $(LIBRARY) miniupnpcmodule.c setup.py
  44. python setup.py build
  45. touch $@
  46. installpythonmodule: pythonmodule
  47. python setup.py install
  48. validateminixml: minixmlvalid
  49. @echo "minixml validation test"
  50. ./minixmlvalid
  51. touch $@
  52. clean:
  53. $(RM) $(LIBRARY) $(SHAREDLIBRARY) $(EXECUTABLES) $(OBJS)
  54. # clean python stuff
  55. $(RM) pythonmodule validateminixml
  56. $(RM) -r build/ dist/
  57. #python setup.py clean
  58. install: $(LIBRARY) $(SHAREDLIBRARY)
  59. $(INSTALL) -d $(INSTALLDIRINC)
  60. $(INSTALL) -m 644 $(HEADERS) $(INSTALLDIRINC)
  61. $(INSTALL) -d $(INSTALLDIRLIB)
  62. $(INSTALL) -m 644 $(LIBRARY) $(INSTALLDIRLIB)
  63. $(INSTALL) -m 644 $(SHAREDLIBRARY) $(INSTALLDIRLIB)/$(SONAME)
  64. $(INSTALL) -d $(INSTALLDIRBIN)
  65. $(INSTALL) -m 755 upnpc-shared $(INSTALLDIRBIN)/upnpc
  66. ln -fs $(SONAME) $(INSTALLDIRLIB)/$(SHAREDLIBRARY)
  67. cleaninstall:
  68. $(RM) -r $(INSTALLDIRINC)
  69. $(RM) $(INSTALLDIRLIB)/$(LIBRARY)
  70. $(RM) $(INSTALLDIRLIB)/$(SHAREDLIBRARY)
  71. depend:
  72. makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null
  73. $(LIBRARY): $(LIBOBJS)
  74. $(AR) crs $@ $?
  75. $(SHAREDLIBRARY): $(LIBOBJS)
  76. $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^
  77. upnpc-static: upnpc.o $(LIBRARY)
  78. $(CC) -o $@ $^
  79. upnpc-shared: upnpc.o $(SHAREDLIBRARY)
  80. $(CC) -o $@ $^
  81. testminixml: minixml.o igd_desc_parse.o testminixml.o
  82. minixmlvalid: minixml.o minixmlvalid.o
  83. testupnpreplyparse: testupnpreplyparse.o minixml.o upnpreplyparse.o
  84. testigddescparse: testigddescparse.o igd_desc_parse.o minixml.o
  85. # DO NOT DELETE THIS LINE -- make depend depends on it.
  86. igd_desc_parse.o: igd_desc_parse.h
  87. miniupnpc.o: miniupnpc.h declspec.h igd_desc_parse.h minissdpc.h miniwget.h
  88. miniupnpc.o: minisoap.h minixml.h upnpcommands.h upnpreplyparse.h
  89. minixml.o: minixml.h
  90. minisoap.o: minisoap.h miniupnpcstrings.h
  91. miniwget.o: miniupnpc.h declspec.h igd_desc_parse.h miniupnpcstrings.h
  92. upnpc.o: miniwget.h declspec.h miniupnpc.h igd_desc_parse.h upnpcommands.h
  93. upnpc.o: upnpreplyparse.h upnperrors.h
  94. upnpcommands.o: upnpcommands.h upnpreplyparse.h declspec.h miniupnpc.h
  95. upnpcommands.o: igd_desc_parse.h
  96. upnpreplyparse.o: upnpreplyparse.h minixml.h
  97. testminixml.o: minixml.h igd_desc_parse.h
  98. minixmlvalid.o: minixml.h
  99. testupnpreplyparse.o: upnpreplyparse.h
  100. minissdpc.o: minissdpc.h miniupnpc.h declspec.h igd_desc_parse.h codelength.h
  101. upnperrors.o: upnperrors.h declspec.h upnpcommands.h upnpreplyparse.h
  102. testigddescparse.o: igd_desc_parse.h minixml.h