put /local/librnd/CFLAGS_HIDLIB_STATIC_ {}
append /local/librnd/CFLAGS_HIDLIB_STATIC_ ?/local/librnd/CFLAGS_HIDLIB_STATIC
put /local/librnd/LDFLAGS_HIDLIB_STATIC_ {}
append /local/librnd/LDFLAGS_HIDLIB_STATIC_ ?/local/librnd/LDFLAGS_HIDLIB_STATIC

if ?libs/script/fungw/presents
then
# system installed fungw
	append /local/librnd/CFLAGS_HIDLIB_STATIC_ libs/script/fungw/cflags
	append /local/librnd/LDFLAGS_HIDLIB_STATIC_ libs/script/fungw/ldflags
end
append /local/librnd/LDFLAGS_HIDLIB_STATIC_ [@ -lm @?/target/libs/ldl@ @]


uniq /local/librnd/CFLAGS_HIDLIB_STATIC_
uniq /local/librnd/LDFLAGS_HIDLIB_STATIC_

gsub /local/librnd/CFLAGS_HIDLIB_STATIC_ {[.][.]/src_3rd/} {$(LIBRND_ROOT)/src_3rd/}

# Lesstif requires that -lXm is before -lXt or else there is a runtime BadWindow error
order /local/librnd/LDFLAGS_HIDLIB_STATIC_ {-lXm} {before} {-lXt}

# non-standard installation prefix requires extra -I and -L
switch /local/prefix
	case {^/usr$} end
	case {^/usr/local$} end
	default
		put /local/librnd/librnd_mak_extra_inc [@-I@/local/prefix@/include@]
		put /local/librnd/librnd_mak_extra_ldf [@-L@/local/prefix@/@/local/libarchdir@@]
	end
end

print [@

#
# Auto-generated Makefile for inclusion for librnd users.
#
# The user's Makefile needs to, in this order:
#  - include this file
#  - use the variables declared in this file for compilation and linking
#

LIBRND_PREFIX=@/local/prefix@
LIBRND_INCDIR=$(LIBRND_PREFIX)/include/librnd4

# Note: no need to define LIBRND_SHAREDIR: librnd.mak is included from there
# so the user already has it

# architecture specific name of "/lib":
# some systems want to put 64 bit libs and binaries in /lib64 instead of /lib
LIBRND_LIBARCHDIR=@/local/libarchdir@

# librnd's binaries ran during build of an app, but not directly by user
LIBRND_LIBDIR=$(LIBRND_PREFIX)/$(LIBRND_LIBARCHDIR)/librnd4

# where the .so files are installed
LIBRND_SODIR=$(LIBRND_PREFIX)/$(LIBRND_LIBARCHDIR)

# where librnd plugins are installed (should be on puplug search path)
LIBRND_PLUGDIR=$(LIBRND_LIBDIR)/plugins

CFLAGS_LIBRND_STATIC=@?/local/librnd/CFLAGS_HIDLIB_STATIC_@ -I$(LIBRND_INCDIR) -I$(LIBRND_INCDIR)/librnd/src_3rd @?/local/librnd/librnd_mak_extra_inc@
LDFLAGS_LIBRND_STATIC=@?/local/librnd/librnd_mak_extra_ldf@ @?/local/librnd/LDFLAGS_HIDLIB_STATIC_@

CFLAGS_LIBRND=-I$(LIBRND_INCDIR) -I$(LIBRND_INCDIR)/librnd/src_3rd @?/local/librnd/librnd_mak_extra_inc@
LDFLAGS_LIBRND=@?/local/librnd/librnd_mak_extra_ldf@

# build helper tools
PUPLUG=$(LIBRND_LIBDIR)/puplug
SPHASH=$(LIBRND_LIBDIR)/sphash
BUILD_PS=$(LIBRND_LIBDIR)/build_ps.sh
KEYLIST=$(LIBRND_LIBDIR)/keylist.sh
MENU2SVG=$(LIBRND_LIBDIR)/menu2svg.sh
FONT2C=$(LIBRND_LIBDIR)/devhelpers/font2c.sh
CQUOTE=$(LIBRND_LIBDIR)/scconfig/cquote
GENCONF=$(LIBRND_LIBDIR)/scconfig/gen_conf.sh

# These are extracts of the fungw-specific parts; only needed if the the above
# are NOT used (partial linking)
@]
if ?libs/script/fungw/presents
then
print [@
CFLAGS_LIBRND_FUNGW=@libs/script/fungw/cflags@
LDFLAGS_LIBRND_FUNGW=@libs/script/fungw/ldflags@
@]
else
print [@
CFLAGS_LIBRND_FUNGW=
LDFLAGS_LIBRND_FUNGW=
@]
end


print [@
LIBRND_EXE=@/target/sys/ext_exe@
@]
