/*
 * Samples Imakefile < Imakefile >
 *
 * Sample programs of XBGI: Borland Graphics Interface for Xlib
 *
 * Copyright (c) 1992-94,95 Tokyo Denki University, Taiji Yamada
 */
.SUFFIXES: .cxx
#include "../config.h"

EXTRA_INCLUDES = -I../sources/common -I../sources/x11 -I../sources/ps -I../sources/misc -I../graffit/sources

#if defined(BuildConcatenatedLib)
#ifdef UseInstalledXBGI
LOCAL_LIBRARIES = $(XBGILIB) $(XTOOLLIB) $(XPMLIB) $(XLIB)
#else
#if DoSharedLib && !defined(LinuxArchitecture)
all:: libgraffit.so libxbgi.so

libgraffit.so:
	$(RM) $@*
	$(LN) ../graffit/sources/libgraffit.so* .
	-if [ ! -f $@ ]; then $(LN) $@* $@; fi

libxbgi.so:
	$(RM) $@*
	$(LN) ../sources/libxbgi.so* .
	-if [ ! -f $@ ]; then $(LN) $@* $@; fi

clean::
	$(RM) ./libgraffit.so* ./libxbgi.so*
LOCAL_LDFLAGS = -L.
LOCAL_LIBRARIES = -lgraffit -lxbgi $(XTOOLLIB) $(XPMLIB) $(XLIB)
#else
LOCAL_LIBRARIES = ../graffit/sources/libgraffit.a ../sources/libxbgi.a $(XTOOLLIB) $(XPMLIB) $(XLIB)
#endif
#endif
#else
#ifdef UseInstalledXBGI
LOCAL_LIBRARIES = $(XBGILIB) $(XTOOLLIB) $(XPMLIB) $(XLIB)
#else
#if DoSharedLib && !defined(LinuxArchitecture)
all:: libgraffit.so libxbgi_$(DefaultStandaloneLib).so libxbgi_common.so libxbgi_misc.so

libgraffit.so:
	$(RM) $@*
	$(LN) ../graffit/sources/libgraffit.so* .
	-if [ ! -f $@ ]; then $(LN) $@* $@; fi

libxbgi_$(DefaultStandaloneLib).so:
	$(RM) $@*
	$(LN) ../sources/$(DefaultStandaloneLib)/libxbgi_$(DefaultStandaloneLib).so* .
	-if [ ! -f $@ ]; then $(LN) $@* $@; fi

libxbgi_common.so:
	$(RM) $@*
	$(LN) ../sources/common/libxbgi_common.so* .
	-if [ ! -f $@ ]; then $(LN) $@* $@; fi

libxbgi_misc.so:
	$(RM) $@*
	$(LN) ../sources/misc/libxbgi_misc.so* .
	-if [ ! -f $@ ]; then $(LN) $@* $@; fi

clean::
	$(RM) ./libxbgi_common.so* ./libxbgi_misc.so*
LOCAL_LDFLAGS = -L.
LOCAL_LIBRARIES = -lgraffit -lxbgi_$(DefaultStandaloneLib) -lxbgi_common -lxbgi_misc $(XTOOLLIB) $(XPMLIB) $(XLIB)
#else
LOCAL_LIBRARIES = ../graffit/sources/libgraffit.a ../sources/$(DefaultStandaloneLib)/libxbgi_$(DefaultStandaloneLib).a ../sources/common/libxbgi_common.a ../sources/misc/libxbgi_misc.a $(XTOOLLIB) $(XPMLIB) $(XLIB)
#endif
#endif
#endif

.c:
	$(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRA_INCLUDES) $(LDFLAGS) $(LOCAL_LDFLAGS) $< -o $@ $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)

.cxx:
	$(CXX) $(CFLAGS) $(CPPFLAGS) $(EXTRA_INCLUDES) $(LDFLAGS) $(LOCAL_LDFLAGS) $< -o $@ $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)

TARGETS =\
 attract\
 attract2\
 axes\
 axes_\
 bgidemo\
 carpet\
 chaos\
 clock\
 colors\
 cubes\
 draw\
 hello\
 hello2\
 hello2-sj\
 hello2-jis\
 mandara\
 mandel\
 message\
 pages\
 pages2\
 pages3\
 pages4\
 penta\
 recurse\
 sponge\
 strange\
 strange2\
 texttest\
 points\
 graph

TARGETS_CXX =\
# julia

all:: hello2-sj.c hello2-jis.c $(TARGETS) $(TARGETS_CXX)

clean::
	-$(RM) $(TARGETS) hello2-sj.c hello2-jis.c

#if defined(SparcArchitecture)
EUCTOSJ = euctosj
EUCTOJIS = euctojis
#else
EUCTOSJ = nkf -s
EUCTOJIS = nkf -j
#endif

hello2-sj.c: hello2.c
	$(EUCTOSJ) $< > $@

hello2-jis.c: hello2.c
	$(EUCTOJIS) $< > $@
