]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSWindows/Java/makefile
mDNSResponder-87.tar.gz
[apple/mdnsresponder.git] / mDNSWindows / Java / makefile
1 # Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
2 #
3 # @APPLE_LICENSE_HEADER_START@
4 #
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
10 # file.
11 #
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.
19 #
20 # @APPLE_LICENSE_HEADER_END@
21 #
22 # $Log: makefile,v $
23 # Revision 1.3 2004/11/23 08:13:07 shersche
24 # Link to the iphlpapi.lib for GetAdaptersInfo
25 #
26 # Revision 1.2 2004/06/26 20:07:06 rpantos
27 # Update to use WinVersRes.h
28 #
29 # Revision 1.1 2004/06/18 04:12:05 rpantos
30 # Move up one level. Integration changes for Scott.
31 #
32 # Revision 1.2 2004/05/01 00:31:41 rpantos
33 # Change line endings for CVS.
34 #
35 # Revision 1.1 2004/04/30 16:32:34 rpantos
36 # First checked in.
37 #
38 # This Makefile builds a .jar file and accompanying JNI support library
39 # containing the DNSSD implementation for Java and support classes.
40 #
41 # Prior to building Java support, you must build DNSSD.dll.
42 #
43 # nmake with no arguments builds all production targets.
44 # 'nmake DEBUG=1' to build debugging targets.
45 # 'nmake clean' or 'nmake clean DEBUG=1' to delete prod/debug objects & targets
46 #
47 # To run nmake, you may need to set up your PATH correctly, using a script
48 # such as: "\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat"
49 #
50 # The default location of the JDK is \javasdk. You can override this on the
51 # command line (e.g. 'nmake JDK=\j2dk1.4.2_03').
52
53 ############################################################################
54
55 COREDIR = ..\..\mDNSCore
56 SHAREDDIR = ..\..\mDNSShared
57
58 JDK = \javasdk
59
60 CC = cl
61 RC = rc
62 LD = ld
63 CP = copy
64 RM = del /Q
65 RMDIR = rmdir /S /Q
66 JAVAC = $(JDK)\bin\javac
67 JAVAH = $(JDK)\bin\javah
68 JAR = $(JDK)\bin\jar
69 CFLAGS_COMMON = -LD -DAUTO_CALLBACKS=0 -I. -I..\.. \
70 -I$(COREDIR) -I$(SHAREDDIR) -I$(JDK)\include -I$(JDK)\include\win32
71
72 # Set up diverging paths for debug vs. prod builds
73 DEBUG=0
74 !if $(DEBUG) == 1
75 CFLAGS_DEBUG = -Zi -DMDNS_DEBUGMSGS=2
76 OBJDIR = objects\debug
77 BUILDDIR = build\debug
78 LIBDIR = ..\DLL\Debug
79 !else
80 CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0
81 OBJDIR = objects\prod
82 BUILDDIR = build\prod
83 LIBDIR = ..\DLL\Release
84 !endif
85
86 CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_DEBUG)
87 JAVACFLAGS = $(CFLAGS) $(JAVACFLAGS_OS)
88
89 #############################################################################
90
91 all: setup Java
92
93 # 'setup' sets up the build directory structure the way we want
94 setup:
95 @if not exist objects mkdir objects
96 @if not exist build mkdir build
97 @if not exist $(OBJDIR) mkdir $(OBJDIR)
98 @if not exist $(BUILDDIR) mkdir $(BUILDDIR)
99
100 # clean removes targets and objects
101 clean:
102 @if exist $(OBJDIR) $(RMDIR) $(OBJDIR)
103 @if exist $(BUILDDIR) $(RMDIR) $(BUILDDIR)
104
105 #############################################################################
106
107 # The following targets build Java wrappers for the dns-sd.h API.
108
109 Java: setup $(BUILDDIR)\dns_sd.jar $(BUILDDIR)\jdns_sd.dll
110 @echo "Java wrappers done"
111
112 JAVASRC = $(SHAREDDIR)\Java
113 JARCONTENTS = $(OBJDIR)\com\apple\dnssd\DNSSDService.class \
114 $(OBJDIR)\com\apple\dnssd\DNSRecord.class \
115 $(OBJDIR)\com\apple\dnssd\DNSSDException.class \
116 $(OBJDIR)\com\apple\dnssd\TXTRecord.class \
117 $(OBJDIR)\com\apple\dnssd\DNSSDRegistration.class \
118 $(OBJDIR)\com\apple\dnssd\BaseListener.class \
119 $(OBJDIR)\com\apple\dnssd\BrowseListener.class \
120 $(OBJDIR)\com\apple\dnssd\ResolveListener.class \
121 $(OBJDIR)\com\apple\dnssd\RegisterListener.class \
122 $(OBJDIR)\com\apple\dnssd\QueryListener.class \
123 $(OBJDIR)\com\apple\dnssd\DomainListener.class \
124 $(OBJDIR)\com\apple\dnssd\DNSSD.class
125
126 $(BUILDDIR)\dns_sd.jar: $(JARCONTENTS)
127 $(JAR) -cf $@ -C $(OBJDIR) com
128
129 $(BUILDDIR)\jdns_sd.dll: $(JAVASRC)\JNISupport.c $(OBJDIR)\DNSSD.java.h $(OBJDIR)\jdns_sd.RES
130 $(CC) -Fe$@ $(JAVASRC)\JNISupport.c $(CFLAGS) -I$(OBJDIR) \
131 $(LIBDIR)\DNSSD.lib $(JDK)\lib\jvm.lib ws2_32.lib iphlpapi.lib $(OBJDIR)\jdns_sd.RES
132
133 .SUFFIXES : .java
134 {$(JAVASRC)}.java{$(OBJDIR)\com\apple\dnssd}.class:
135 $(JAVAC) -d $(OBJDIR) -classpath $(OBJDIR) $<
136
137 $(OBJDIR)\DNSSD.java.h: $(OBJDIR)\com\apple\dnssd\DNSSD.class
138 $(JAVAH) -classpath $(OBJDIR) -o $@ \
139 com.apple.dnssd.AppleBrowser \
140 com.apple.dnssd.AppleResolver \
141 com.apple.dnssd.AppleRegistration \
142 com.apple.dnssd.AppleQuery \
143 com.apple.dnssd.AppleService
144
145 $(OBJDIR)\jdns_sd.RES: jdns_sd.rc
146 $(RC) /fo $@ $?
147