1 # Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
3 # @APPLE_LICENSE_HEADER_START@
5 # This file contains Original Code and/or Modifications of Original Code
6 # as defined in and that are subject to the Apple Public Source License
7 # Version 2.0 (the 'License'). You may not use this file except in
8 # compliance with the License. Please obtain a copy of the License at
9 # http://www.opensource.apple.com/apsl/ and read it before using this
12 # The Original Code and all software distributed under the License are
13 # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
17 # Please see the License for the specific language governing rights and
18 # limitations under the License.
20 # @APPLE_LICENSE_HEADER_END@
23 # Revision 1.4 2004/12/16 22:38:00 shersche
24 # Compile DNSSDException.java first to avoid build errors, copy output to appropriate "buildroot" folder
26 # Revision 1.3 2004/11/23 08:13:07 shersche
27 # Link to the iphlpapi.lib for GetAdaptersInfo
29 # Revision 1.2 2004/06/26 20:07:06 rpantos
30 # Update to use WinVersRes.h
32 # Revision 1.1 2004/06/18 04:12:05 rpantos
33 # Move up one level. Integration changes for Scott.
35 # Revision 1.2 2004/05/01 00:31:41 rpantos
36 # Change line endings for CVS.
38 # Revision 1.1 2004/04/30 16:32:34 rpantos
41 # This Makefile builds a .jar file and accompanying JNI support library
42 # containing the DNSSD implementation for Java and support classes.
44 # Prior to building Java support, you must build DNSSD.dll.
46 # nmake with no arguments builds all production targets.
47 # 'nmake DEBUG=1' to build debugging targets.
48 # 'nmake clean' or 'nmake clean DEBUG=1' to delete prod/debug objects & targets
50 # To run nmake, you may need to set up your PATH correctly, using a script
51 # such as: "\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat"
53 # The default location of the JDK is \javasdk. You can override this on the
54 # command line (e.g. 'nmake JDK=\j2dk1.4.2_03').
56 ############################################################################
58 COREDIR = ..\..\mDNSCore
59 SHAREDDIR = ..\..\mDNSShared
69 JAVAC = $(JDK)\bin\javac
70 JAVAH = $(JDK)\bin\javah
72 CFLAGS_COMMON = -LD -DAUTO_CALLBACKS=0 -I. -I..\.. \
73 -I$(COREDIR) -I$(SHAREDDIR) -I$(JDK)\include -I$(JDK)\include\win32
75 # Set up diverging paths for debug vs. prod builds
78 CFLAGS_DEBUG = -Zi -DMDNS_DEBUGMSGS=2
79 OBJDIR = objects\debug
80 BUILDDIR = build\debug
83 CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0
86 LIBDIR = ..\DLL\Release
89 CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_DEBUG)
90 JAVACFLAGS = $(CFLAGS) $(JAVACFLAGS_OS)
92 #############################################################################
94 all: setup Java postbuild
96 # 'setup' sets up the build directory structure the way we want
98 @if not exist objects mkdir objects
99 @if not exist build mkdir build
100 @if not exist $(OBJDIR) mkdir $(OBJDIR)
101 @if not exist $(BUILDDIR) mkdir $(BUILDDIR)
103 !if DEFINED(DNSSD_BUILD_ROOT)
106 copy $(BUILDDIR)\dns_sd.jar $(DNSSD_BUILD_ROOT)\Debug\Root\"Program Files"\bin
107 copy $(BUILDDIR)\jdns_sd.dll $(DNSSD_BUILD_ROOT)\Debug\Root\"Program Files"\bin
110 copy $(BUILDDIR)\dns_sd.jar $(DNSSD_BUILD_ROOT)\Release\Root\"Program Files"\bin
111 copy $(BUILDDIR)\jdns_sd.dll $(DNSSD_BUILD_ROOT)\Release\Root\"Program Files"\bin
117 # clean removes targets and objects
119 @if exist $(OBJDIR) $(RMDIR) $(OBJDIR)
120 @if exist $(BUILDDIR) $(RMDIR) $(BUILDDIR)
122 #############################################################################
124 # The following targets build Java wrappers for the dns-sd.h API.
126 Java: setup $(BUILDDIR)\dns_sd.jar $(BUILDDIR)\jdns_sd.dll postbuild
127 @echo "Java wrappers done"
129 JAVASRC = $(SHAREDDIR)\Java
130 JARCONTENTS = $(OBJDIR)\com\apple\dnssd\DNSSDService.class \
131 $(OBJDIR)\com\apple\dnssd\DNSSDException.class \
132 $(OBJDIR)\com\apple\dnssd\DNSRecord.class \
133 $(OBJDIR)\com\apple\dnssd\TXTRecord.class \
134 $(OBJDIR)\com\apple\dnssd\DNSSDRegistration.class \
135 $(OBJDIR)\com\apple\dnssd\BaseListener.class \
136 $(OBJDIR)\com\apple\dnssd\BrowseListener.class \
137 $(OBJDIR)\com\apple\dnssd\ResolveListener.class \
138 $(OBJDIR)\com\apple\dnssd\RegisterListener.class \
139 $(OBJDIR)\com\apple\dnssd\QueryListener.class \
140 $(OBJDIR)\com\apple\dnssd\DomainListener.class \
141 $(OBJDIR)\com\apple\dnssd\DNSSD.class
143 $(BUILDDIR)\dns_sd.jar: $(JARCONTENTS)
144 $(JAR) -cf $@ -C $(OBJDIR) com
146 $(BUILDDIR)\jdns_sd.dll: $(JAVASRC)\JNISupport.c $(OBJDIR)\DNSSD.java.h $(OBJDIR)\jdns_sd.RES
147 $(CC) -Fe$@ $(JAVASRC)\JNISupport.c $(CFLAGS) -I$(OBJDIR) \
148 $(LIBDIR)\DNSSD.lib $(JDK)\lib\jvm.lib ws2_32.lib iphlpapi.lib $(OBJDIR)\jdns_sd.RES
151 {$(JAVASRC)}.java{$(OBJDIR)\com\apple\dnssd}.class:
152 $(JAVAC) -d $(OBJDIR) -classpath $(OBJDIR) $<
154 $(OBJDIR)\DNSSD.java.h: $(OBJDIR)\com\apple\dnssd\DNSSD.class
155 $(JAVAH) -classpath $(OBJDIR) -o $@ \
156 com.apple.dnssd.AppleBrowser \
157 com.apple.dnssd.AppleResolver \
158 com.apple.dnssd.AppleRegistration \
159 com.apple.dnssd.AppleQuery \
160 com.apple.dnssd.AppleService
162 $(OBJDIR)\jdns_sd.RES: jdns_sd.rc