]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSWindows/Java/makefile
mDNSResponder-878.270.2.tar.gz
[apple/mdnsresponder.git] / mDNSWindows / Java / makefile
1 # -*- tab-width: 4 -*-
2 #
3 # Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # This Makefile builds a .jar file and accompanying JNI support library
18 # containing the DNSSD implementation for Java and support classes.
19 #
20 # Prior to building Java support, you must build DNSSD.dll.
21 #
22 # nmake with no arguments builds all production targets.
23 # 'nmake DEBUG=1' to build debugging targets.
24 # 'nmake clean' or 'nmake clean DEBUG=1' to delete prod/debug objects & targets
25 #
26 # To run nmake, you may need to set up your PATH correctly, using a script
27 # such as: "\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat"
28 #
29 # The default location of the JDK is \javasdk. You can override this on the
30 # command line (e.g. 'nmake JDK=\j2dk1.4.2_03').
31
32 ############################################################################
33
34 COREDIR = ..\..\mDNSCore
35 SHAREDDIR = ..\..\mDNSShared
36
37 JDK = "$(JAVA_HOME)"
38
39 CC = cl
40 RC = rc
41 LD = ld
42 CP = copy
43 RM = del /Q
44 RMDIR = rmdir /S /Q
45 JAVAC = $(JDK)\bin\javac
46 JAVAH = $(JDK)\bin\javah
47 JAR = $(JDK)\bin\jar
48 CFLAGS_COMMON = -LD -DAUTO_CALLBACKS=0 -I. -I..\.. \
49 -I$(COREDIR) -I$(SHAREDDIR) -I$(JDK)\include -I$(JDK)\include\win32
50
51 # Set up diverging paths for debug vs. prod builds
52 DEBUG=0
53 !if $(DEBUG) == 1
54 CFLAGS_DEBUG = -Zi -DMDNS_DEBUGMSGS=2
55 OBJDIR = objects\debug
56 BUILDDIR = build\debug
57 INSTALLDIR = root\"Program Files"\Bonjour
58 LIBDIR = ..\DLL\Win32\Debug
59 !else
60 CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0
61 OBJDIR = objects\prod
62 BUILDDIR = build\prod
63 INSTALLDIR = root\"Program Files"\Bonjour
64 LIBDIR = ..\DLL\Win32\Release
65 !endif
66
67 CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_DEBUG)
68 JAVACFLAGS = $(CFLAGS) $(JAVACFLAGS_OS)
69
70 #############################################################################
71
72 all: setup Java postbuild
73
74 # 'setup' sets up the build directory structure the way we want
75 setup:
76 @if not exist objects mkdir objects
77 @if not exist build mkdir build
78 @if not exist $(OBJDIR) mkdir $(OBJDIR)
79 @if not exist $(BUILDDIR) mkdir $(BUILDDIR)
80
81 postbuild:
82 @if not "%RC_XBS%"=="YES" GOTO CONT
83 @if not exist "$(DSTROOT)\WINDOWS\system32\Win32" mkdir "$(DSTROOT)\WINDOWS\system32\Win32"
84 @if not exist "$(DSTROOT)\Program Files\Bonjour\Win32" mkdir "$(DSTROOT)\Program Files\Bonjour\Win32"
85 @copy $(BUILDDIR)\jdns_sd.dll "$(DSTROOT)\WINDOWS\system32\Win32"
86 @copy $(BUILDDIR)\dns_sd.jar "$(DSTROOT)\Program Files\Bonjour\Win32"
87 @:CONT
88 @if not exist root mkdir root
89 @if not exist root\"Program Files" mkdir root\"Program Files"
90 @if not exist $(INSTALLDIR) mkdir $(INSTALLDIR)
91 copy $(BUILDDIR)\dns_sd.jar $(INSTALLDIR)
92 copy $(BUILDDIR)\jdns_sd.dll $(INSTALLDIR)
93
94 # clean removes targets and objects
95 clean:
96 @if exist $(OBJDIR) $(RMDIR) $(OBJDIR)
97 @if exist $(BUILDDIR) $(RMDIR) $(BUILDDIR)
98
99 #############################################################################
100
101 # The following targets build Java wrappers for the dns-sd.h API.
102
103 Java: setup $(BUILDDIR)\dns_sd.jar $(BUILDDIR)\jdns_sd.dll postbuild
104 @echo "Java wrappers done"
105
106 JAVASRC = $(SHAREDDIR)\Java
107 JARCONTENTS = $(OBJDIR)\com\apple\dnssd\DNSSDService.class \
108 $(OBJDIR)\com\apple\dnssd\DNSSDException.class \
109 $(OBJDIR)\com\apple\dnssd\DNSRecord.class \
110 $(OBJDIR)\com\apple\dnssd\TXTRecord.class \
111 $(OBJDIR)\com\apple\dnssd\DNSSDRegistration.class \
112 $(OBJDIR)\com\apple\dnssd\DNSSDRecordRegistrar.class \
113 $(OBJDIR)\com\apple\dnssd\BaseListener.class \
114 $(OBJDIR)\com\apple\dnssd\BrowseListener.class \
115 $(OBJDIR)\com\apple\dnssd\ResolveListener.class \
116 $(OBJDIR)\com\apple\dnssd\RegisterListener.class \
117 $(OBJDIR)\com\apple\dnssd\RegisterRecordListener.class \
118 $(OBJDIR)\com\apple\dnssd\QueryListener.class \
119 $(OBJDIR)\com\apple\dnssd\DomainListener.class \
120 $(OBJDIR)\com\apple\dnssd\DNSSD.class
121
122 $(BUILDDIR)\dns_sd.jar: $(JARCONTENTS)
123 $(JAR) -cf $@ -C $(OBJDIR) com
124
125 $(BUILDDIR)\jdns_sd.dll: $(JAVASRC)\JNISupport.c $(OBJDIR)\DNSSD.java.h $(OBJDIR)\jdns_sd.RES
126 $(CC) -Fe$@ $(JAVASRC)\JNISupport.c $(CFLAGS) -I$(OBJDIR) \
127 $(LIBDIR)\DNSSD.lib $(JDK)\lib\jvm.lib ws2_32.lib iphlpapi.lib $(OBJDIR)\jdns_sd.RES /link /NXCOMPAT /DYNAMICBASE /SAFESEH
128
129 .SUFFIXES : .java
130 {$(JAVASRC)}.java{$(OBJDIR)\com\apple\dnssd}.class:
131 $(JAVAC) -d $(OBJDIR) -classpath $(OBJDIR) $<
132
133 $(OBJDIR)\DNSSD.java.h: $(OBJDIR)\com\apple\dnssd\DNSSD.class
134 $(JAVAH) -classpath $(OBJDIR) -o $@ \
135 com.apple.dnssd.AppleBrowser \
136 com.apple.dnssd.AppleResolver \
137 com.apple.dnssd.AppleRegistration \
138 com.apple.dnssd.AppleQuery \
139 com.apple.dnssd.AppleService
140
141 $(OBJDIR)\jdns_sd.RES: jdns_sd.rc
142 $(RC) /fo $@ $?
143