]>
Commit | Line | Data |
---|---|---|
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 | 16 | # |
8e92c31c A |
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 | # | |
7f0064bd | 29 | # The default location of the JDK is \javasdk. You can override this on the |
8e92c31c A |
30 | # command line (e.g. 'nmake JDK=\j2dk1.4.2_03'). |
31 | ||
32 | ############################################################################ | |
33 | ||
7f0064bd A |
34 | COREDIR = ..\..\mDNSCore |
35 | SHAREDDIR = ..\..\mDNSShared | |
8e92c31c | 36 | |
9f221bca | 37 | JDK = "$(JAVA_HOME)" |
8e92c31c A |
38 | |
39 | CC = cl | |
7f0064bd | 40 | RC = rc |
8e92c31c A |
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 | |
7f0064bd | 48 | CFLAGS_COMMON = -LD -DAUTO_CALLBACKS=0 -I. -I..\.. \ |
8e92c31c A |
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 | |
7cb34e5c | 57 | INSTALLDIR = root\"Program Files"\Bonjour |
32bb7e43 | 58 | LIBDIR = ..\DLL\Win32\Debug |
8e92c31c A |
59 | !else |
60 | CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0 | |
61 | OBJDIR = objects\prod | |
62 | BUILDDIR = build\prod | |
7cb34e5c | 63 | INSTALLDIR = root\"Program Files"\Bonjour |
32bb7e43 | 64 | LIBDIR = ..\DLL\Win32\Release |
8e92c31c A |
65 | !endif |
66 | ||
67 | CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_DEBUG) | |
68 | JAVACFLAGS = $(CFLAGS) $(JAVACFLAGS_OS) | |
69 | ||
70 | ############################################################################# | |
71 | ||
283ee3ff | 72 | all: setup Java postbuild |
8e92c31c A |
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 | ||
283ee3ff | 81 | postbuild: |
32bb7e43 A |
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 | |
7cb34e5c A |
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) | |
283ee3ff | 93 | |
8e92c31c A |
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 | ||
283ee3ff | 103 | Java: setup $(BUILDDIR)\dns_sd.jar $(BUILDDIR)\jdns_sd.dll postbuild |
8e92c31c A |
104 | @echo "Java wrappers done" |
105 | ||
106 | JAVASRC = $(SHAREDDIR)\Java | |
107 | JARCONTENTS = $(OBJDIR)\com\apple\dnssd\DNSSDService.class \ | |
8e92c31c | 108 | $(OBJDIR)\com\apple\dnssd\DNSSDException.class \ |
283ee3ff | 109 | $(OBJDIR)\com\apple\dnssd\DNSRecord.class \ |
8e92c31c A |
110 | $(OBJDIR)\com\apple\dnssd\TXTRecord.class \ |
111 | $(OBJDIR)\com\apple\dnssd\DNSSDRegistration.class \ | |
32bb7e43 | 112 | $(OBJDIR)\com\apple\dnssd\DNSSDRecordRegistrar.class \ |
8e92c31c A |
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 \ | |
32bb7e43 | 117 | $(OBJDIR)\com\apple\dnssd\RegisterRecordListener.class \ |
8e92c31c A |
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 | ||
7f0064bd | 125 | $(BUILDDIR)\jdns_sd.dll: $(JAVASRC)\JNISupport.c $(OBJDIR)\DNSSD.java.h $(OBJDIR)\jdns_sd.RES |
8e92c31c | 126 | $(CC) -Fe$@ $(JAVASRC)\JNISupport.c $(CFLAGS) -I$(OBJDIR) \ |
263eeeab | 127 | $(LIBDIR)\DNSSD.lib $(JDK)\lib\jvm.lib ws2_32.lib iphlpapi.lib $(OBJDIR)\jdns_sd.RES /link /NXCOMPAT /DYNAMICBASE /SAFESEH |
8e92c31c A |
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 | ||
7f0064bd A |
141 | $(OBJDIR)\jdns_sd.RES: jdns_sd.rc |
142 | $(RC) /fo $@ $? | |
143 |