#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

ROOTDEMODIRBASE=	$(ROOT)/usr/demo/ksh

DEMOFILES= \
	doc/RELEASE \
	doc/README \
	doc/TYPES \
	doc/DESIGN \
	doc/COMPATIBILITY \
	doc/OBSOLETE \
	bin/crawlsrccomments \
	bin/filemutexdemo1 \
	bin/filetree1 \
	bin/gnaw \
	bin/mandelbrotset1 \
	bin/multifollow \
	bin/primenumbers1 \
	bin/rssread \
	bin/shcalc \
	bin/shircbot \
	bin/shlint \
	bin/shman \
	bin/shnote \
	bin/shpiano \
	bin/shtinyurl \
	bin/shtwitter \
	bin/svcproptree1 \
	bin/termclock \
	bin/test_net_sctp \
	bin/xmldocumenttree1 \
	fun/dirs \
	fun/popd \
	fun/pushd \
	fun/title \
	tests/shtests \
	tests/alias.sh \
	tests/append.sh \
	tests/arith.sh \
	tests/arrays.sh \
	tests/arrays2.sh \
	tests/attributes.sh \
	tests/basic.sh \
	tests/bracket.sh \
	tests/builtins.sh \
	tests/case.sh \
	tests/comvar.sh \
	tests/coprocess.sh \
	tests/cubetype.sh \
	tests/enum.sh \
	tests/exit.sh \
	tests/expand.sh \
	tests/functions.sh \
	tests/glob.sh \
	tests/grep.sh \
	tests/heredoc.sh \
	tests/io.sh \
	tests/locale.sh \
	tests/nameref.sh \
	tests/options.sh \
	tests/path.sh \
	tests/pointtype.sh \
	tests/quoting.sh \
	tests/quoting2.sh \
	tests/recttype.sh \
	tests/restricted.sh \
	tests/return.sh \
	tests/select.sh \
	tests/sigchld.sh \
	tests/signal.sh \
	tests/statics.sh \
	tests/sun_solaris_builtin_sum.sh \
	tests/sun_solaris_compoundvario.sh \
	tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh \
	tests/sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh \
	tests/sun_solaris_cr_6722134_background_CHLD_trap.sh \
	tests/sun_solaris_cr_6753538_subshell_leaks_umask.sh \
	tests/sun_solaris_cr_6754020_weird_square_bracket_expansion.sh \
	tests/sun_solaris_cr_6763594_command_failure_execs_twice.sh \
	tests/sun_solaris_cr_6766246_pattern_matching_bug.sh \
	tests/sun_solaris_cr_6800929_large_command_substitution_hang.sh \
	tests/sun_solaris_cr_6807179_shellpattern_uses_getpwnam.sh \
	tests/sun_solaris_getconf.sh \
	tests/sun_solaris_local_compound_nameref001.sh \
	tests/sun_solaris_staticvariables.sh \
	tests/sun_solaris_vartree001.sh \
	tests/sun_solaris_vartree002.sh \
	tests/sun_solaris_vartree003.sh \
	tests/substring.sh \
	tests/subshell.sh \
	tests/tilde.sh \
	tests/timetype.sh \
	tests/types.sh \
	tests/variables.sh \
	tests/vartree1.sh \
	tests/vartree2.sh

# Rules for executables
$(ROOTDEMODIRBASE)/tests/shtests := FILEMODE= 755
$(ROOTDEMODIRBASE)/fun/%	 := FILEMODE= 755
$(ROOTDEMODIRBASE)/bin/%	 := FILEMODE= 755

# ToDO: We should replace the "cat $<" below with $ shcomp $< # once the
# build machines start to ship /usr/bin/shcomp to compile the scripts
# in bin/ and use $ shcomp -n $< /dev/null 2>&1 # to do minimum lint-style
# checks before installation.
$(ROOTDEMODIRBASE)/bin/%: common/scripts/%.sh
	cat "$<" >"$(@F)"
	$(INS) -s -m $(FILEMODE) -f $(@D) "$(@F)"
	$(RM) "$(@F)"
	
# Documentation rules
$(ROOTDEMODIRBASE)/doc/%: common/%
	$(INS.file)

$(ROOTDEMODIRBASE)/doc/%: misc/%
	$(INS.file)

ROOTDEMODIRS=	$(ROOTDEMODIRBASE) .WAIT \
		$(ROOTDEMODIRBASE)/bin \
		$(ROOTDEMODIRBASE)/doc \
		$(ROOTDEMODIRBASE)/fun \
		$(ROOTDEMODIRBASE)/tests

install: $(ROOTDEMODIRS) .WAIT $(ROOTDEMOFILES)