3 # Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
 
   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
 
   9 #     http://www.apache.org/licenses/LICENSE-2.0
 
  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.
 
  17 # This Makefile builds .jar files for the DNS-SD Java sample apps.
 
  18 # You must have the Java support installed.
 
  20 # nmake with no arguments builds all production targets.
 
  21 # 'nmake DEBUG=1' to build debugging targets.
 
  22 # 'nmake clean' or 'nmake clean DEBUG=1' to delete prod/debug objects & targets
 
  24 # To run nmake, you may need to set up your PATH correctly, using a script 
 
  25 # such as: "\Program Files\Microsoft Visual Studio .NET\Common7\tools\vsvars32.bat"
 
  27 # The default location of the JDK is \javasdk. You can override this on the
 
  28 # command line (e.g. 'nmake JDK=\j2dk1.4.2_03').
 
  30 ############################################################################
 
  37 JAVAC = $(JDK)\bin\javac
 
  38 JAVAH = $(JDK)\bin\javah
 
  41 # Set up diverging paths for debug vs. prod builds
 
  45 OBJDIR = objects\debug
 
  46 BUILDDIR = build\debug
 
  53 SCOBJ = $(OBJDIR)\SimpleChat
 
  54 BAOBJ = $(OBJDIR)\BrowserApp
 
  56 #############################################################################
 
  58 all: setup Java postbuild
 
  60 # 'setup' sets up the build directory structure the way we want
 
  62         @if not exist objects           mkdir objects
 
  63         @if not exist build                     mkdir build
 
  64         @if not exist $(OBJDIR)         mkdir $(OBJDIR)
 
  65         @if not exist $(SCOBJ)          mkdir $(SCOBJ)
 
  66         @if not exist $(BAOBJ)          mkdir $(BAOBJ)
 
  67         @if not exist $(BUILDDIR)       mkdir $(BUILDDIR)
 
  70         @if not "%RC_XBS%"=="YES" GOTO END
 
  71         @if not exist "$(DSTROOT)\Program Files\Bonjour SDK\Samples\Java" mkdir "$(DSTROOT)\Program Files\Bonjour SDK\Samples\Java"
 
  72         @copy "nmakefile"                       "$(DSTROOT)\Program Files\Bonjour SDK\Samples\Java"
 
  73         @copy "BrowserApp.java"         "$(DSTROOT)\Program Files\Bonjour SDK\Samples\Java"
 
  74         @copy "SimpleChat.java"         "$(DSTROOT)\Program Files\Bonjour SDK\Samples\Java"
 
  75         @copy "Swing*.java"                     "$(DSTROOT)\Program Files\Bonjour SDK\Samples\Java"
 
  76         @copy "$(BUILDDIR)\*.jar"       "$(DSTROOT)\Program Files\Bonjour SDK\Samples\Java"
 
  79 # clean removes targets and objects
 
  81         @if exist $(OBJDIR)             $(RMDIR) $(OBJDIR)
 
  82         @if exist $(BUILDDIR)   $(RMDIR) $(BUILDDIR)
 
  84 #############################################################################
 
  86 Java: setup $(BUILDDIR)\SimpleChat.jar $(BUILDDIR)\BrowserApp.jar
 
  87         @echo "Build complete"
 
  89 SIMPLECHATOBJ = $(SCOBJ)\SwingBrowseListener.class \
 
  90                                 $(SCOBJ)\SwingQueryListener.class \
 
  91                                 $(SCOBJ)\SimpleChat.class 
 
  92 SIMPLECHATMAN = SimpleChat.manifest
 
  94 $(BUILDDIR)\SimpleChat.jar: $(SIMPLECHATOBJ) $(SIMPLECHATMAN)
 
  95         $(JAR) -cfm $@ $(SIMPLECHATMAN) -C $(SCOBJ) .
 
  97 BROWSERAPPOBJ = $(BAOBJ)\BrowserApp.class 
 
  98 BROWSERAPPMAN = BrowserApp.manifest
 
 100 $(BUILDDIR)\BrowserApp.jar: $(BROWSERAPPOBJ) $(BROWSERAPPMAN)
 
 101         $(JAR) -cfm $@ $(BROWSERAPPMAN) -C $(BAOBJ) .
 
 105 {$(JAVASRC)}.java{$(BAOBJ)}.class:      
 
 106         $(JAVAC) -d $(BAOBJ) -classpath $(BAOBJ);$(DNS_SD) $<
 
 107 {$(JAVASRC)}.java{$(SCOBJ)}.class:      
 
 108         $(JAVAC) -d $(SCOBJ) -classpath $(SCOBJ);$(DNS_SD) $<