1: # $Id: Makefile,v 1.1.1.1 2023/09/27 11:25:11 misho Exp $
2: # MiniUPnP Project
3: # http://miniupnp.free.fr/
4: # (c) 2005-2017 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: OS = $(shell $(CC) -dumpmachine)
12:
13: CC ?= gcc
14: #AR = gar
15: CFLAGS = -O0 -g -DDEBUG
16: #CFLAGS = -O
17: CFLAGS += -fPIC
18: CFLAGS += -ansi
19: CFLAGS += -Wall -W
20: CFLAGS += -D_BSD_SOURCE
21: ifeq (, $(findstring darwin, $(OS))$(findstring freebsd, $(OS)))
22: #CFLAGS += -D_POSIX_C_SOURCE=200112L
23: CFLAGS += -D_XOPEN_SOURCE=600
24: endif
25: CFLAGS += -DUPNPC_USE_SELECT
26: INSTALL = install
27:
28: #following libs are needed on Solaris
29: ifneq (, $(findstring sun, $(OS)))
30: LDLIBS += -lsocket -lnsl -lresolv
31: CFLAGS += -D__EXTENSIONS__
32: endif
33:
34: # APIVERSION is used to build SONAME
35: APIVERSION = 0
36:
37: SRCS = miniupnpc-async.c parsessdpreply.c \
38: upnputils.c igd_desc_parse.c minixml.c \
39: upnpreplyparse.c \
40: testasync.c
41:
42: LIBOBJS = miniupnpc-async.o parsessdpreply.o \
43: upnputils.o igd_desc_parse.o minixml.o \
44: upnpreplyparse.o
45:
46: OBJS = $(patsubst %.c,%.o,$(SRCS))
47:
48: # HEADERS to install
49: HEADERS = miniupnpc-async.h
50: LIBRARY = libminiupnpc-async.a
51: SHAREDLIBRARY = libminiupnpc-async.so
52: SONAME = $(SHAREDLIBRARY).$(APIVERSION)
53: EXECUTABLES = testasync
54:
55: INSTALLPREFIX ?= $(PREFIX)/usr
56: INSTALLDIRINC = $(INSTALLPREFIX)/include/miniupnpc
57: INSTALLDIRLIB = $(INSTALLPREFIX)/lib
58: INSTALLDIRBIN = $(INSTALLPREFIX)/bin
59:
60: .PHONY: install clean depend all installpythonmodule
61:
62: all: $(LIBRARY) $(EXECUTABLES)
63:
64: check:
65: @echo "To be implemented"
66:
67: pythonmodule: $(LIBRARY) miniupnpcmodule.c setup.py
68: python setup.py build
69: touch $@
70:
71: installpythonmodule: pythonmodule
72: python setup.py install
73:
74: clean:
75: $(RM) $(LIBRARY) $(SHAREDLIBRARY) $(EXECUTABLES) $(OBJS)
76: # clean python stuff
77: $(RM) pythonmodule
78: $(RM) -r build/ dist/
79: #python setup.py clean
80:
81: install: $(LIBRARY) $(SHAREDLIBRARY)
82: $(INSTALL) -d $(INSTALLDIRINC)
83: $(INSTALL) -m 644 $(HEADERS) $(INSTALLDIRINC)
84: $(INSTALL) -d $(INSTALLDIRLIB)
85: $(INSTALL) -m 644 $(LIBRARY) $(INSTALLDIRLIB)
86: $(INSTALL) -m 644 $(SHAREDLIBRARY) $(INSTALLDIRLIB)/$(SONAME)
87: $(INSTALL) -d $(INSTALLDIRBIN)
88: $(INSTALL) -m 755 $(EXECUTABLES) $(INSTALLDIRBIN)
89: ln -fs $(SONAME) $(INSTALLDIRLIB)/$(SHAREDLIBRARY)
90:
91: cleaninstall:
92: $(RM) -r $(INSTALLDIRINC)
93: $(RM) $(INSTALLDIRLIB)/$(LIBRARY)
94: $(RM) $(INSTALLDIRLIB)/$(SHAREDLIBRARY)
95:
96: depend:
97: makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null
98:
99: $(LIBRARY): $(LIBOBJS)
100: $(AR) crs $@ $?
101:
102: $(SHAREDLIBRARY): $(LIBOBJS)
103: $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^
104:
105: upnpc-static: upnpc.o $(LIBRARY)
106: $(CC) -o $@ $^
107:
108: upnpc-shared: upnpc.o $(SHAREDLIBRARY)
109: $(CC) -o $@ $^
110:
111: testasync: testasync.o libminiupnpc-async.a
112: #testasync: testasync.o -lminiupnpc-async
113:
114: # DO NOT DELETE THIS LINE -- make depend depends on it.
115:
116: miniupnpc-async.o: miniupnpc-async.h declspec.h parsessdpreply.h upnputils.h
117: parsessdpreply.o: parsessdpreply.h
118: testasync.o: miniupnpc-async.h declspec.h
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>