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