Makefile revision 4904:cd464a980538
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25#ident	"%Z%%M%	%I%	%E% SMI"
26
27include ../Makefile.com
28
29DNSSD_PKG = com.apple.dnssd
30
31TOP = $(SRC)/lib/libdns_sd/java
32JAVASRCDIR = $(TOP)/com/apple/dnssd
33CLASSPATH = $(TOP):com/apple/dnssd
34
35JAVAFLAGS +=	-source 1.4 -target 1.4
36SOURCE:sh = ls *.java
37CLASSES = $(SOURCE:java=class)
38JNIH    = DNSSD.java.h
39JAR_FILE = dnssd.jar
40
41DOCDIR = $(JAVASRCDIR)/docs
42DOCAPIDIR = $(JAVASRCDIR)/docs/api
43DOCDESTDIR = $(ROOTDNSSDJAVAHOME)/javadoc/dnssd
44DOCAPIDESTDIR = $(DOCDESTDIR)/api
45DOCEXAMPLESDESTDIR = $(DOCDESTDIR)/examples
46
47EXAMPLESDIR = $(JAVASRCDIR)/docs/examples
48EXAMPLESSRC = $(JAVASRCDIR)/docs/examples/src
49SIMPLECHATOBJ = $(EXAMPLESDIR)/SwingBrowseListener.class \
50                $(EXAMPLESDIR)/SwingQueryListener.class \
51                $(EXAMPLESDIR)/SimpleChat.class 
52BROWSERAPPOBJ = $(EXAMPLESDIR)/SwingResolveListener.class \
53		$(EXAMPLESDIR)/SwingDomainListener.class \
54                $(EXAMPLESDIR)/BrowserApp.class 
55EXAMPLEOBJS   = $(SIMPLECHATOBJ) $(BROWSERAPPOBJ)
56EXAMPLEJARS   = SimpleChat.jar BrowserApp.jar
57
58INSTALL_JAR = $(ROOTDNSSDJAVAHOME)/$(JAR_FILE)
59INSTALL_EXAMPLEJARS = $(DOCEXAMPLESDESTDIR)/SimpleChat.jar \
60		      $(DOCEXAMPLESDESTDIR)/BrowserApp.jar
61		     
62CLEAN_FILES = *.class $(JNIH) *.jar $(EXAMPLESDIR)/*.class $(EXAMPLESDIR)/*.jar
63
64DEFINES=
65
66INCLUDES=	-I${JAVA_HOME}/include	\
67		-I${JAVA_HOME}/include/solaris
68
69.KEEP_STATE:
70
71all:	$(JNIH) $(CLASSES) $(EXAMPLEOBJS) doc
72
73install:	$(CLASSES) $(ROOTDNSSDJAVAHOME)	\
74		$(DOCEXAMPLESDESTDIR) $(DOCEXAMPLESSRCDESTDIR) \
75		$(JAR_FILE) $(INSTALL_JAR) $(JNIH) \
76		$(EXAMPLEJARS) $(INSTALL_EXAMPLEJARS) \
77		install_doc
78
79$(JNIH): $(CLASSES) 
80	class="com.apple.dnssd.AppleDNSSD \
81		com.apple.dnssd.AppleBrowser \
82		com.apple.dnssd.AppleResolver \
83		com.apple.dnssd.AppleRegistration \
84		com.apple.dnssd.AppleQuery \
85		com.apple.dnssd.AppleDomainEnum \
86		com.apple.dnssd.AppleService"; \
87	$(JAVAH) -classpath $(CLASSPATH) -jni -o $(JNIH) $$class
88
89clean clobber:
90	$(RM) $(CLEAN_FILES)
91
92$(JAR_FILE): $(CLASSES)
93	cd $(TOP); \
94	$(JAR) -cvf $(TOP)/com/apple/dnssd/$(JAR_FILE) com/apple/dnssd/*.class
95
96$(EXAMPLESDIR)/%.class: $(EXAMPLESSRC)/%.java
97	$(JAVAC) $(JAVAFLAGS) $< -classpath $(CLASSPATH):$(EXAMPLESDIR) -d $(EXAMPLESDIR)
98
99SIMPLECHATMAN = $(EXAMPLESSRC)/SimpleChat.manifest
100
101SimpleChat.jar: $(SIMPLECHATOBJ) $(SIMPLECHATMAN)
102		cd $(EXAMPLESDIR); $(JAR) -cvfm $@ $(SIMPLECHATMAN) \
103		SwingBrowseListener.class SwingQueryListener.class \
104		SimpleChat.class SimpleChat\$$1.class \
105		ListenerThread.class TargetListElem.class \
106		TargetListModel.class src/SimpleChat.java \
107		src/SimpleChat.manifest src/SwingBrowseListener.java \
108		src/SwingQueryListener.java
109
110BROWSERAPPMAN = $(EXAMPLESSRC)/BrowserApp.manifest
111
112BrowserApp.jar: $(BROWSERAPPOBJ) $(BROWSERAPPMAN)
113		cd $(EXAMPLESDIR); $(JAR) -cvfm $@ $(BROWSERAPPMAN) \
114		BrowserApp\$$1.class BrowserApp.class \
115		BrowserListModel\$$BrowserListElem.class \
116		BrowserListModel.class DomainListModel.class \
117		ServicesBrowserListModel.class \
118		SwingResolveListener.class SwingDomainListener.class \
119		src/BrowserApp.java src/SwingResolveListener.java \
120		src/SwingDomainListener.java src/BrowserApp.manifest
121	
122$(ROOTDNSSDJAVAHOME):
123	$(INS.dir)
124
125$(ROOTDNSSDJAVAHOME)/%: %
126	$(INS.file)
127
128$(DOCDESTDIR):
129	$(INS.dir)
130
131$(DOCAPIDESTDIR): $(DOCDESTDIR)
132	$(INS.dir)
133
134$(DOCEXAMPLESDESTDIR): $(DOCDESTDIR)
135	$(INS.dir)
136
137$(DOCEXAMPLESDESTDIR)/%: %
138	$(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $(EXAMPLESDIR)/$<
139
140install_doc: $(CLASSES) $(DOCAPIDESTDIR)
141	-$(RM) -r $(DOCAPIDESTDIR)/*
142	cd $(TOP); umask 022; \
143	$(JAVADOC) $(JAVASRCDIR)/*.java -classpath $(CLASSPATH) -d \
144	$(DOCAPIDESTDIR) -public $(DNSSD_PKG)
145
146doc:
147	-@mkdir -p $(DOCAPIDIR)
148	cd $(TOP); umask 022; \
149	$(JAVADOC) $(JAVASRCDIR)/*.java -classpath $(CLASSPATH) -d \
150	$(DOCAPIDIR) -public $(DNSSD_PKG)
151