1###########################################################################
2##
3## Copyright (c) 2000-2003 Intel Corporation
4## All rights reserved.
5##
6## Redistribution and use in source and binary forms, with or without
7## modification, are permitted provided that the following conditions are met:
8##
9## * Redistributions of source code must retain the above copyright notice,
10## this list of conditions and the following disclaimer.
11## * Redistributions in binary form must reproduce the above copyright notice,
12## this list of conditions and the following disclaimer in the documentation
13## and/or other materials provided with the distribution.
14## * Neither name of Intel Corporation nor the names of its contributors
15## may be used to endorse or promote products derived from this software
16## without specific prior written permission.
17##
18## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
22## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27## NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29##
30###########################################################################
31
32MAKE = make
33ifdef TARGET
34DIR_PATH=$(TARGET)/
35CROSS=$(TARGET)-
36endif
37
38ifeq ($(INSURE),1)
39CC=insure -pthread
40endif
41
42ifeq ($(DEBUG),1)
43TARGET_OUTPUT=../bin/debug/$(DIR_PATH)libupnp.so
44else
45TARGET_OUTPUT=../bin/$(DIR_PATH)libupnp.so
46endif
47
48
49
50ifndef JAVA_DIR
51JAVA_DIR= /usr/java/jdk1.3
52endif
53
54SUBDIRS = ssdp soap genlib gena urlconfig api uuid
55
56ifeq ($(JNI),1)
57#LIBS+= $(JAVA_DIR)/jre/lib/i386/client/libjvm.so ../../ixml/bin/libixmlJNI.so
58LIBS+= ../../ixml/bin/libixmlJNI.so
59SUBDIRS += jni
60endif
61
62ifeq ($(EFENCE),1)
63LIBS+= -lefence
64endif
65
66INCLUDES = -I inc -I ../inc -I inc/tools
67C2FLAGS = -Wall $(DEFS) -shared -Wl,-soname,libupnp.so
68
69ifeq ($(DEBUG),1)
70DBG=DEBUG=1
71LIBS+=../bin/debug/$(DIR_PATH)libthreadutil_dbg.so ../bin/debug/$(DIR_PATH)libixml.so
72LIBDEPS += ../bin/debug/$(DIR_PATH)libthreadutil_dbg.so ../bin/debug/$(DIR_PATH)libixml.so
73OBJECT_DIR = lib/debug/$(DIR_PATH)
74else
75DBG=
76LIBS+=../bin/$(DIR_PATH)libthreadutil.so ../bin/$(DIR_PATH)libixml.so
77LIBDEPS += ../bin/$(DIR_PATH)libthreadutil.so ../bin/$(DIR_PATH)libixml.so
78OBJECT_DIR = lib/$(DIR_PATH)
79endif
80
81OBJECTS = $(OBJECT_DIR)api.o $(OBJECT_DIR)/ssdp.o $(OBJECT_DIR)/soap.o $(OBJECT_DIR)/uuid.o\
82	$(OBJECT_DIR)/miniserverall.o $(OBJECT_DIR)/service_table.o \
83	$(OBJECT_DIR)/uriall.o $(OBJECT_DIR)/client_table.o $(OBJECT_DIR)/utilall.o \
84	$(OBJECT_DIR)/netall.o $(OBJECT_DIR)/httpall.o $(OBJECT_DIR)/urlconfigall.o \
85	$(OBJECT_DIR)/gena.o
86
87ifeq ($(JNI),1)
88OBJECTS += lib/jniupnpall.o
89endif
90
91ifeq ($(STATIC),1)
92all: $(LIBDEPS)
93	@set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i $(DBG); done
94	$(AR) r ../bin/libupnp.a $(OBJECTS)
95else
96all:
97	@set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i $(DBG); done
98	$(CC) $(C2FLAGS) $(OBJECTS) -o $(TARGET_OUTPUT) $(LD_PATH) $(LIBS)
99endif
100
101
102clean:
103	@set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done
104
105