3 # Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
18 # Revision 1.9 2006/08/14 23:26:04 cheshire
19 # Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
21 # Revision 1.8 2006/07/05 20:57:22 cheshire
22 # <rdar://problem/3839132> Java needs to implement DNSServiceRegisterRecord equivalent
24 # Revision 1.7 2005/10/19 17:19:56 herscher
25 # Change JDK to use JAVA_HOME environment variable
27 # Revision 1.6 2005/02/10 22:35:36 cheshire
28 # <rdar://problem/3727944> Update name
30 # Revision 1.5 2005/02/08 23:47:51 shersche
31 # Build into proper directories for installer
33 # Revision 1.4 2004/12/16 22:38:00 shersche
34 # Compile DNSSDException.java first to avoid build errors, copy output to appropriate "buildroot" folder
36 # Revision 1.3 2004/11/23 08:13:07 shersche
37 # Link to the iphlpapi.lib for GetAdaptersInfo
39 # Revision 1.2 2004/06/26 20:07:06 rpantos
40 # Update to use WinVersRes.h
42 # Revision 1.1 2004/06/18 04:12:05 rpantos
43 # Move up one level. Integration changes for Scott.
45 # Revision 1.2 2004/05/01 00:31:41 rpantos
46 # Change line endings for CVS.
48 # Revision 1.1 2004/04/30 16:32:34 rpantos
51 # This Makefile builds a .jar file and accompanying JNI support library
52 # containing the DNSSD implementation for Java and support classes.
54 # Prior to building Java support, you must build DNSSD.dll.
56 # nmake with no arguments builds all production targets.
57 # 'nmake DEBUG=1' to build debugging targets.
58 # 'nmake clean' or 'nmake clean DEBUG=1' to delete prod/debug objects & targets
60 # To run nmake, you may need to set up your PATH correctly, using a script
61 # such as: "\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat"
63 # The default location of the JDK is \javasdk. You can override this on the
64 # command line (e.g. 'nmake JDK=\j2dk1.4.2_03').
66 ############################################################################
68 COREDIR = ..\..\mDNSCore
69 SHAREDDIR = ..\..\mDNSShared
79 JAVAC = $(JDK)\bin\javac
80 JAVAH = $(JDK)\bin\javah
82 CFLAGS_COMMON = -LD -DAUTO_CALLBACKS=0 -I. -I..\.. \
83 -I$(COREDIR) -I$(SHAREDDIR) -I$(JDK)\include -I$(JDK)\include\win32
85 # Set up diverging paths for debug vs. prod builds
88 CFLAGS_DEBUG = -Zi -DMDNS_DEBUGMSGS=2
89 OBJDIR = objects\debug
90 BUILDDIR = build\debug
91 INSTALLDIR = root\"Program Files"\Bonjour
94 CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0
97 INSTALLDIR = root\"Program Files"\Bonjour
98 LIBDIR = ..\DLL\Release
101 CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_DEBUG)
102 JAVACFLAGS = $(CFLAGS) $(JAVACFLAGS_OS)
104 #############################################################################
106 all: setup Java postbuild
108 # 'setup' sets up the build directory structure the way we want
110 @if not exist objects mkdir objects
111 @if not exist build mkdir build
112 @if not exist $(OBJDIR) mkdir $(OBJDIR)
113 @if not exist $(BUILDDIR) mkdir $(BUILDDIR)
116 @if not exist root mkdir root
117 @if not exist root\"Program Files" mkdir root\"Program Files"
118 @if not exist $(INSTALLDIR) mkdir $(INSTALLDIR)
119 copy $(BUILDDIR)\dns_sd.jar $(INSTALLDIR)
120 copy $(BUILDDIR)\jdns_sd.dll $(INSTALLDIR)
122 # clean removes targets and objects
124 @if exist $(OBJDIR) $(RMDIR) $(OBJDIR)
125 @if exist $(BUILDDIR) $(RMDIR) $(BUILDDIR)
127 #############################################################################
129 # The following targets build Java wrappers for the dns-sd.h API.
131 Java: setup $(BUILDDIR)\dns_sd.jar $(BUILDDIR)\jdns_sd.dll postbuild
132 @echo "Java wrappers done"
134 JAVASRC = $(SHAREDDIR)\Java
135 JARCONTENTS = $(OBJDIR)\com\apple\dnssd\DNSSDService.class \
136 $(OBJDIR)\com\apple\dnssd\DNSSDException.class \
137 $(OBJDIR)\com\apple\dnssd\DNSRecord.class \
138 $(OBJDIR)\com\apple\dnssd\TXTRecord.class \
139 $(OBJDIR)\com\apple\dnssd\DNSSDRegistration.class \
140 $(OBJDIR)\com\apple\dnssd\BaseListener.class \
141 $(OBJDIR)\com\apple\dnssd\BrowseListener.class \
142 $(OBJDIR)\com\apple\dnssd\ResolveListener.class \
143 $(OBJDIR)\com\apple\dnssd\RegisterListener.class \
144 $(OBJDIR)\com\apple\dnssd\QueryListener.class \
145 $(OBJDIR)\com\apple\dnssd\DomainListener.class \
146 $(OBJDIR)\com\apple\dnssd\DNSSDRecordRegistrar.class \
147 $(OBJDIR)\com\apple\dnssd\RegisterRecordListener.class \
148 $(OBJDIR)\com\apple\dnssd\DNSSD.class
150 $(BUILDDIR)\dns_sd.jar: $(JARCONTENTS)
151 $(JAR) -cf $@ -C $(OBJDIR) com
153 $(BUILDDIR)\jdns_sd.dll: $(JAVASRC)\JNISupport.c $(OBJDIR)\DNSSD.java.h $(OBJDIR)\jdns_sd.RES
154 $(CC) -Fe$@ $(JAVASRC)\JNISupport.c $(CFLAGS) -I$(OBJDIR) \
155 $(LIBDIR)\DNSSD.lib $(JDK)\lib\jvm.lib ws2_32.lib iphlpapi.lib $(OBJDIR)\jdns_sd.RES
158 {$(JAVASRC)}.java{$(OBJDIR)\com\apple\dnssd}.class:
159 $(JAVAC) -d $(OBJDIR) -classpath $(OBJDIR) $<
161 $(OBJDIR)\DNSSD.java.h: $(OBJDIR)\com\apple\dnssd\DNSSD.class
162 $(JAVAH) -classpath $(OBJDIR) -o $@ \
163 com.apple.dnssd.AppleBrowser \
164 com.apple.dnssd.AppleResolver \
165 com.apple.dnssd.AppleRegistration \
166 com.apple.dnssd.AppleQuery \
167 com.apple.dnssd.AppleService
169 $(OBJDIR)\jdns_sd.RES: jdns_sd.rc