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.10 2009/03/30 20:22:43 herscher
19 # <rdar://problem/5925472> Current Bonjour code does not compile on Windows
20 # Update LIBDIR to work with new build directory structure
21 # Create postbuild rules for new buildtrain
23 # Revision 1.9 2006/08/14 23:26:04 cheshire
24 # Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
26 # Revision 1.8 2006/07/05 20:57:22 cheshire
27 # <rdar://problem/3839132> Java needs to implement DNSServiceRegisterRecord equivalent
29 # Revision 1.7 2005/10/19 17:19:56 herscher
30 # Change JDK to use JAVA_HOME environment variable
32 # Revision 1.6 2005/02/10 22:35:36 cheshire
33 # <rdar://problem/3727944> Update name
35 # Revision 1.5 2005/02/08 23:47:51 shersche
36 # Build into proper directories for installer
38 # Revision 1.4 2004/12/16 22:38:00 shersche
39 # Compile DNSSDException.java first to avoid build errors, copy output to appropriate "buildroot" folder
41 # Revision 1.3 2004/11/23 08:13:07 shersche
42 # Link to the iphlpapi.lib for GetAdaptersInfo
44 # Revision 1.2 2004/06/26 20:07:06 rpantos
45 # Update to use WinVersRes.h
47 # Revision 1.1 2004/06/18 04:12:05 rpantos
48 # Move up one level. Integration changes for Scott.
50 # Revision 1.2 2004/05/01 00:31:41 rpantos
51 # Change line endings for CVS.
53 # Revision 1.1 2004/04/30 16:32:34 rpantos
56 # This Makefile builds a .jar file and accompanying JNI support library
57 # containing the DNSSD implementation for Java and support classes.
59 # Prior to building Java support, you must build DNSSD.dll.
61 # nmake with no arguments builds all production targets.
62 # 'nmake DEBUG=1' to build debugging targets.
63 # 'nmake clean' or 'nmake clean DEBUG=1' to delete prod/debug objects & targets
65 # To run nmake, you may need to set up your PATH correctly, using a script
66 # such as: "\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat"
68 # The default location of the JDK is \javasdk. You can override this on the
69 # command line (e.g. 'nmake JDK=\j2dk1.4.2_03').
71 ############################################################################
73 COREDIR = ..\..\mDNSCore
74 SHAREDDIR = ..\..\mDNSShared
84 JAVAC = $(JDK)\bin\javac
85 JAVAH = $(JDK)\bin\javah
87 CFLAGS_COMMON = -LD -DAUTO_CALLBACKS=0 -I. -I..\.. \
88 -I$(COREDIR) -I$(SHAREDDIR) -I$(JDK)\include -I$(JDK)\include\win32
90 # Set up diverging paths for debug vs. prod builds
93 CFLAGS_DEBUG = -Zi -DMDNS_DEBUGMSGS=2
94 OBJDIR = objects\debug
95 BUILDDIR = build\debug
96 INSTALLDIR = root\"Program Files"\Bonjour
97 LIBDIR = ..\DLL\Win32\Debug
99 CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0
100 OBJDIR = objects\prod
101 BUILDDIR = build\prod
102 INSTALLDIR = root\"Program Files"\Bonjour
103 LIBDIR = ..\DLL\Win32\Release
106 CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_DEBUG)
107 JAVACFLAGS = $(CFLAGS) $(JAVACFLAGS_OS)
109 #############################################################################
111 all: setup Java postbuild
113 # 'setup' sets up the build directory structure the way we want
115 @if not exist objects mkdir objects
116 @if not exist build mkdir build
117 @if not exist $(OBJDIR) mkdir $(OBJDIR)
118 @if not exist $(BUILDDIR) mkdir $(BUILDDIR)
121 @if not "%RC_XBS%"=="YES" GOTO CONT
122 @if not exist "$(DSTROOT)\WINDOWS\system32\Win32" mkdir "$(DSTROOT)\WINDOWS\system32\Win32"
123 @if not exist "$(DSTROOT)\Program Files\Bonjour\Win32" mkdir "$(DSTROOT)\Program Files\Bonjour\Win32"
124 @copy $(BUILDDIR)\jdns_sd.dll "$(DSTROOT)\WINDOWS\system32\Win32"
125 @copy $(BUILDDIR)\dns_sd.jar "$(DSTROOT)\Program Files\Bonjour\Win32"
127 @if not exist root mkdir root
128 @if not exist root\"Program Files" mkdir root\"Program Files"
129 @if not exist $(INSTALLDIR) mkdir $(INSTALLDIR)
130 copy $(BUILDDIR)\dns_sd.jar $(INSTALLDIR)
131 copy $(BUILDDIR)\jdns_sd.dll $(INSTALLDIR)
133 # clean removes targets and objects
135 @if exist $(OBJDIR) $(RMDIR) $(OBJDIR)
136 @if exist $(BUILDDIR) $(RMDIR) $(BUILDDIR)
138 #############################################################################
140 # The following targets build Java wrappers for the dns-sd.h API.
142 Java: setup $(BUILDDIR)\dns_sd.jar $(BUILDDIR)\jdns_sd.dll postbuild
143 @echo "Java wrappers done"
145 JAVASRC = $(SHAREDDIR)\Java
146 JARCONTENTS = $(OBJDIR)\com\apple\dnssd\DNSSDService.class \
147 $(OBJDIR)\com\apple\dnssd\DNSSDException.class \
148 $(OBJDIR)\com\apple\dnssd\DNSRecord.class \
149 $(OBJDIR)\com\apple\dnssd\TXTRecord.class \
150 $(OBJDIR)\com\apple\dnssd\DNSSDRegistration.class \
151 $(OBJDIR)\com\apple\dnssd\DNSSDRecordRegistrar.class \
152 $(OBJDIR)\com\apple\dnssd\BaseListener.class \
153 $(OBJDIR)\com\apple\dnssd\BrowseListener.class \
154 $(OBJDIR)\com\apple\dnssd\ResolveListener.class \
155 $(OBJDIR)\com\apple\dnssd\RegisterListener.class \
156 $(OBJDIR)\com\apple\dnssd\RegisterRecordListener.class \
157 $(OBJDIR)\com\apple\dnssd\QueryListener.class \
158 $(OBJDIR)\com\apple\dnssd\DomainListener.class \
159 $(OBJDIR)\com\apple\dnssd\DNSSD.class
161 $(BUILDDIR)\dns_sd.jar: $(JARCONTENTS)
162 $(JAR) -cf $@ -C $(OBJDIR) com
164 $(BUILDDIR)\jdns_sd.dll: $(JAVASRC)\JNISupport.c $(OBJDIR)\DNSSD.java.h $(OBJDIR)\jdns_sd.RES
165 $(CC) -Fe$@ $(JAVASRC)\JNISupport.c $(CFLAGS) -I$(OBJDIR) \
166 $(LIBDIR)\DNSSD.lib $(JDK)\lib\jvm.lib ws2_32.lib iphlpapi.lib $(OBJDIR)\jdns_sd.RES
169 {$(JAVASRC)}.java{$(OBJDIR)\com\apple\dnssd}.class:
170 $(JAVAC) -d $(OBJDIR) -classpath $(OBJDIR) $<
172 $(OBJDIR)\DNSSD.java.h: $(OBJDIR)\com\apple\dnssd\DNSSD.class
173 $(JAVAH) -classpath $(OBJDIR) -o $@ \
174 com.apple.dnssd.AppleBrowser \
175 com.apple.dnssd.AppleResolver \
176 com.apple.dnssd.AppleRegistration \
177 com.apple.dnssd.AppleQuery \
178 com.apple.dnssd.AppleService
180 $(OBJDIR)\jdns_sd.RES: jdns_sd.rc