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.6 2005/02/10 22:35:36 cheshire
24 # <rdar://problem/3727944> Update name
26 # Revision 1.5 2005/02/08 23:47:51 shersche
27 # Build into proper directories for installer
29 # Revision 1.4 2004/12/16 22:38:00 shersche
30 # Compile DNSSDException.java first to avoid build errors, copy output to appropriate "buildroot" folder
32 # Revision 1.3 2004/11/23 08:13:07 shersche
33 # Link to the iphlpapi.lib for GetAdaptersInfo
35 # Revision 1.2 2004/06/26 20:07:06 rpantos
36 # Update to use WinVersRes.h
38 # Revision 1.1 2004/06/18 04:12:05 rpantos
39 # Move up one level. Integration changes for Scott.
41 # Revision 1.2 2004/05/01 00:31:41 rpantos
42 # Change line endings for CVS.
44 # Revision 1.1 2004/04/30 16:32:34 rpantos
47 # This Makefile builds a .jar file and accompanying JNI support library
48 # containing the DNSSD implementation for Java and support classes.
50 # Prior to building Java support, you must build DNSSD.dll.
52 # nmake with no arguments builds all production targets.
53 # 'nmake DEBUG=1' to build debugging targets.
54 # 'nmake clean' or 'nmake clean DEBUG=1' to delete prod/debug objects & targets
56 # To run nmake, you may need to set up your PATH correctly, using a script
57 # such as: "\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat"
59 # The default location of the JDK is \javasdk. You can override this on the
60 # command line (e.g. 'nmake JDK=\j2dk1.4.2_03').
62 ############################################################################
64 COREDIR = ..\..\mDNSCore
65 SHAREDDIR = ..\..\mDNSShared
75 JAVAC = $(JDK)\bin\javac
76 JAVAH = $(JDK)\bin\javah
78 CFLAGS_COMMON = -LD -DAUTO_CALLBACKS=0 -I. -I..\.. \
79 -I$(COREDIR) -I$(SHAREDDIR) -I$(JDK)\include -I$(JDK)\include\win32
81 # Set up diverging paths for debug vs. prod builds
84 CFLAGS_DEBUG = -Zi -DMDNS_DEBUGMSGS=2
85 OBJDIR = objects\debug
86 BUILDDIR = build\debug
87 INSTALLDIR = root\"Program Files"\Bonjour
90 CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0
93 INSTALLDIR = root\"Program Files"\Bonjour
94 LIBDIR = ..\DLL\Release
97 CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_DEBUG)
98 JAVACFLAGS = $(CFLAGS) $(JAVACFLAGS_OS)
100 #############################################################################
102 all: setup Java postbuild
104 # 'setup' sets up the build directory structure the way we want
106 @if not exist objects mkdir objects
107 @if not exist build mkdir build
108 @if not exist $(OBJDIR) mkdir $(OBJDIR)
109 @if not exist $(BUILDDIR) mkdir $(BUILDDIR)
112 @if not exist root mkdir root
113 @if not exist root\"Program Files" mkdir root\"Program Files"
114 @if not exist $(INSTALLDIR) mkdir $(INSTALLDIR)
115 copy $(BUILDDIR)\dns_sd.jar $(INSTALLDIR)
116 copy $(BUILDDIR)\jdns_sd.dll $(INSTALLDIR)
118 # clean removes targets and objects
120 @if exist $(OBJDIR) $(RMDIR) $(OBJDIR)
121 @if exist $(BUILDDIR) $(RMDIR) $(BUILDDIR)
123 #############################################################################
125 # The following targets build Java wrappers for the dns-sd.h API.
127 Java: setup $(BUILDDIR)\dns_sd.jar $(BUILDDIR)\jdns_sd.dll postbuild
128 @echo "Java wrappers done"
130 JAVASRC = $(SHAREDDIR)\Java
131 JARCONTENTS = $(OBJDIR)\com\apple\dnssd\DNSSDService.class \
132 $(OBJDIR)\com\apple\dnssd\DNSSDException.class \
133 $(OBJDIR)\com\apple\dnssd\DNSRecord.class \
134 $(OBJDIR)\com\apple\dnssd\TXTRecord.class \
135 $(OBJDIR)\com\apple\dnssd\DNSSDRegistration.class \
136 $(OBJDIR)\com\apple\dnssd\BaseListener.class \
137 $(OBJDIR)\com\apple\dnssd\BrowseListener.class \
138 $(OBJDIR)\com\apple\dnssd\ResolveListener.class \
139 $(OBJDIR)\com\apple\dnssd\RegisterListener.class \
140 $(OBJDIR)\com\apple\dnssd\QueryListener.class \
141 $(OBJDIR)\com\apple\dnssd\DomainListener.class \
142 $(OBJDIR)\com\apple\dnssd\DNSSD.class
144 $(BUILDDIR)\dns_sd.jar: $(JARCONTENTS)
145 $(JAR) -cf $@ -C $(OBJDIR) com
147 $(BUILDDIR)\jdns_sd.dll: $(JAVASRC)\JNISupport.c $(OBJDIR)\DNSSD.java.h $(OBJDIR)\jdns_sd.RES
148 $(CC) -Fe$@ $(JAVASRC)\JNISupport.c $(CFLAGS) -I$(OBJDIR) \
149 $(LIBDIR)\DNSSD.lib $(JDK)\lib\jvm.lib ws2_32.lib iphlpapi.lib $(OBJDIR)\jdns_sd.RES
152 {$(JAVASRC)}.java{$(OBJDIR)\com\apple\dnssd}.class:
153 $(JAVAC) -d $(OBJDIR) -classpath $(OBJDIR) $<
155 $(OBJDIR)\DNSSD.java.h: $(OBJDIR)\com\apple\dnssd\DNSSD.class
156 $(JAVAH) -classpath $(OBJDIR) -o $@ \
157 com.apple.dnssd.AppleBrowser \
158 com.apple.dnssd.AppleResolver \
159 com.apple.dnssd.AppleRegistration \
160 com.apple.dnssd.AppleQuery \
161 com.apple.dnssd.AppleService
163 $(OBJDIR)\jdns_sd.RES: jdns_sd.rc