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.2 2004/05/01 00:31:41 rpantos
24 # Change line endings for CVS.
26 # Revision 1.1 2004/04/30 16:32:34 rpantos
29 # This Makefile builds a .jar file and accompanying JNI support library
30 # containing the DNSSD implementation for Java and support classes.
32 # Prior to building Java support, you must build DNSSD.dll.
34 # nmake with no arguments builds all production targets.
35 # 'nmake DEBUG=1' to build debugging targets.
36 # 'nmake clean' or 'nmake clean DEBUG=1' to delete prod/debug objects & targets
38 # To run nmake, you may need to set up your PATH correctly, using a script
39 # such as: "\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat"
41 # The default location of the JDK is d:\javasdk. You can override this on the
42 # command line (e.g. 'nmake JDK=\j2dk1.4.2_03').
44 ############################################################################
46 COREDIR = ..\..\..\mDNSCore
47 SHAREDDIR = ..\..\..\mDNSShared
56 JAVAC = $(JDK)\bin\javac
57 JAVAH = $(JDK)\bin\javah
59 CFLAGS_COMMON = -LD -DAUTO_CALLBACKS=1 -DUSE_WIN_API=1 -I. -I..\.. \
60 -I$(COREDIR) -I$(SHAREDDIR) -I$(JDK)\include -I$(JDK)\include\win32
62 # Set up diverging paths for debug vs. prod builds
65 CFLAGS_DEBUG = -Zi -DMDNS_DEBUGMSGS=2
66 OBJDIR = objects\debug
67 BUILDDIR = build\debug
70 CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0
73 LIBDIR = ..\DLL\Release
76 CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_DEBUG)
77 JAVACFLAGS = $(CFLAGS) $(JAVACFLAGS_OS)
79 #############################################################################
83 # 'setup' sets up the build directory structure the way we want
85 @if not exist objects mkdir objects
86 @if not exist build mkdir build
87 @if not exist $(OBJDIR) mkdir $(OBJDIR)
88 @if not exist $(BUILDDIR) mkdir $(BUILDDIR)
90 # clean removes targets and objects
92 @if exist $(OBJDIR) $(RMDIR) $(OBJDIR)
93 @if exist $(BUILDDIR) $(RMDIR) $(BUILDDIR)
95 #############################################################################
97 # The following targets build Java wrappers for the dns-sd.h API.
99 Java: setup $(BUILDDIR)\dns_sd.jar $(BUILDDIR)\jdns_sd.dll
100 @echo "Java wrappers done"
102 JAVASRC = $(SHAREDDIR)\Java
103 JARCONTENTS = $(OBJDIR)\com\apple\dnssd\DNSSDService.class \
104 $(OBJDIR)\com\apple\dnssd\DNSRecord.class \
105 $(OBJDIR)\com\apple\dnssd\DNSSDException.class \
106 $(OBJDIR)\com\apple\dnssd\TXTRecord.class \
107 $(OBJDIR)\com\apple\dnssd\DNSSDRegistration.class \
108 $(OBJDIR)\com\apple\dnssd\BaseListener.class \
109 $(OBJDIR)\com\apple\dnssd\BrowseListener.class \
110 $(OBJDIR)\com\apple\dnssd\ResolveListener.class \
111 $(OBJDIR)\com\apple\dnssd\RegisterListener.class \
112 $(OBJDIR)\com\apple\dnssd\QueryListener.class \
113 $(OBJDIR)\com\apple\dnssd\DomainListener.class \
114 $(OBJDIR)\com\apple\dnssd\DNSSD.class
116 $(BUILDDIR)\dns_sd.jar: $(JARCONTENTS)
117 $(JAR) -cf $@ -C $(OBJDIR) com
119 $(BUILDDIR)\jdns_sd.dll: $(JAVASRC)\JNISupport.c $(OBJDIR)\DNSSD.java.h
120 $(CC) -Fe$@ $(JAVASRC)\JNISupport.c $(CFLAGS) -I$(OBJDIR) \
121 $(LIBDIR)\DNSSD.lib $(JDK)\lib\jvm.lib
124 {$(JAVASRC)}.java{$(OBJDIR)\com\apple\dnssd}.class:
125 $(JAVAC) -d $(OBJDIR) -classpath $(OBJDIR) $<
127 $(OBJDIR)\DNSSD.java.h: $(OBJDIR)\com\apple\dnssd\DNSSD.class
128 $(JAVAH) -classpath $(OBJDIR) -o $@ \
129 com.apple.dnssd.AppleBrowser \
130 com.apple.dnssd.AppleResolver \
131 com.apple.dnssd.AppleRegistration \
132 com.apple.dnssd.AppleQuery \
133 com.apple.dnssd.AppleService