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