# @(#)GNUmakefile	1.2 97/05/19 David Connelly
#
# GNU makefile to build 'jre' for launching Java runtime applications.
#

#
# Default version of Java runtime to locate at startup.
#
VERSION = 1.1

#
# Default location of Java Development Kit
#
JDK = /usr/local/jdk$(VERSION)

#
# Default locations of shared and win32-specific JRE sources.
#
SHARE_SRC = ..
SOLARIS_SRC = .

vpath %.c $(SOLARIS_SRC):$(SHARE_SRC)
vpath %.h $(SOLARIS_SRC):$(SHARE_SRC)

# Use make -DDEBUG to build a debuggable executable. This will be named
# 'jre_g'.
ifdef DEBUG
G = _g
else
G =
endif
OBJ = obj$G

#
# Standard includes and defines
#
INCLUDES = -I$(SOLARIS_SRC) -I$(SHARE_SRC) -I$(JDK)/include \
	   -I$(JDK)/include/solaris
DEFINES  = -DVERSION=\"$(VERSION)\"

#
# DevPro C compiler and linker flags
#
BASECFLAGS = $(DEFINES) $(INCLUDES)
BASELFLAGS =
ifdef DEBUG
CFLAGS = -g -DDEBUG $(BASECFLAGS)
LFLAGS = -g
else
CFLAGS = -O $(BASECFLAGS)
endif
LIBS = -ldl

#
# These are the objects to build jre
#
JRE.o =	$(OBJ)/jre_main.o	\
	$(OBJ)/jre.o		\
	$(OBJ)/jre_md.o

#
# Default target to build jre executable
#

.PHONY: default

default : $(OBJ) jre$G

jre$G : $(JRE.o)
	cc -o $@ $(LFLAGS) $(JRE.o) $(LIBS)

$(JRE.o) : jre.h jre_md.h

#
# Default rules
#

$(OBJ)/%.o : %.c
	$(CC) $(CFLAGS) -c -o $@ $<

#
# Directory setup and cleanup
#

$(OBJ) :
	mkdir $(OBJ)

clean :
	rm -rf $(OBJ) jre$G
