]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSWindows/Java/makefile
mDNSResponder-98.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.4 2004/12/16 22:38:00 shersche
24 # Compile DNSSDException.java first to avoid build errors, copy output to appropriate "buildroot" folder
25 #
26 # Revision 1.3 2004/11/23 08:13:07 shersche
27 # Link to the iphlpapi.lib for GetAdaptersInfo
28 #
29 # Revision 1.2 2004/06/26 20:07:06 rpantos
30 # Update to use WinVersRes.h
31 #
32 # Revision 1.1 2004/06/18 04:12:05 rpantos
33 # Move up one level. Integration changes for Scott.
34 #
35 # Revision 1.2 2004/05/01 00:31:41 rpantos
36 # Change line endings for CVS.
37 #
38 # Revision 1.1 2004/04/30 16:32:34 rpantos
39 # First checked in.
40 #
41 # This Makefile builds a .jar file and accompanying JNI support library
42 # containing the DNSSD implementation for Java and support classes.
43 #
44 # Prior to building Java support, you must build DNSSD.dll.
45 #
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
49 #
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"
52 #
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').
55
56 ############################################################################
57
58 COREDIR = ..\..\mDNSCore
59 SHAREDDIR = ..\..\mDNSShared
60
61 JDK = \javasdk
62
63 CC = cl
64 RC = rc
65 LD = ld
66 CP = copy
67 RM = del /Q
68 RMDIR = rmdir /S /Q
69 JAVAC = $(JDK)\bin\javac
70 JAVAH = $(JDK)\bin\javah
71 JAR = $(JDK)\bin\jar
72 CFLAGS_COMMON = -LD -DAUTO_CALLBACKS=0 -I. -I..\.. \
73 -I$(COREDIR) -I$(SHAREDDIR) -I$(JDK)\include -I$(JDK)\include\win32
74
75 # Set up diverging paths for debug vs. prod builds
76 DEBUG=0
77 !if $(DEBUG) == 1
78 CFLAGS_DEBUG = -Zi -DMDNS_DEBUGMSGS=2
79 OBJDIR = objects\debug
80 BUILDDIR = build\debug
81 LIBDIR = ..\DLL\Debug
82 !else
83 CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0
84 OBJDIR = objects\prod
85 BUILDDIR = build\prod
86 LIBDIR = ..\DLL\Release
87 !endif
88
89 CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_DEBUG)
90 JAVACFLAGS = $(CFLAGS) $(JAVACFLAGS_OS)
91
92 #############################################################################
93
94 all: setup Java postbuild
95
96 # 'setup' sets up the build directory structure the way we want
97 setup:
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)
102
103 !if DEFINED(DNSSD_BUILD_ROOT)
104 !if $(DEBUG) == 1
105 postbuild:
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
108 !else
109 postbuild:
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
112 !endif
113 !else
114 postbuild:
115 !endif
116
117 # clean removes targets and objects
118 clean:
119 @if exist $(OBJDIR) $(RMDIR) $(OBJDIR)
120 @if exist $(BUILDDIR) $(RMDIR) $(BUILDDIR)
121
122 #############################################################################
123
124 # The following targets build Java wrappers for the dns-sd.h API.
125
126 Java: setup $(BUILDDIR)\dns_sd.jar $(BUILDDIR)\jdns_sd.dll postbuild
127 @echo "Java wrappers done"
128
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
142
143 $(BUILDDIR)\dns_sd.jar: $(JARCONTENTS)
144 $(JAR) -cf $@ -C $(OBJDIR) com
145
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
149
150 .SUFFIXES : .java
151 {$(JAVASRC)}.java{$(OBJDIR)\com\apple\dnssd}.class:
152 $(JAVAC) -d $(OBJDIR) -classpath $(OBJDIR) $<
153
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
161
162 $(OBJDIR)\jdns_sd.RES: jdns_sd.rc
163 $(RC) /fo $@ $?
164