/*
 * Make makefile for sample programs
 *
 * Sample programs of xbgi
 *
 * Copyright (C) 1992-1994,1995 Taiji Yamada, Tokyo Denki University
 * Copyright (C) 1995-1999 Taiji Yamada, AIHARA Electrical Engineering Co.,Ltd.
 */
.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)

#if defined(UseInstalledXBGI)

LOCAL_LIBRARIES = $(XBGILIB) $(XTOOLLIB) $(XPMLIB) $(XLIB)

#else /* !defined(UseInstalledXBGI) */

#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 /* !DoSharedLib */

LOCAL_LIBRARIES = ../graffit/sources/libgraffit.a ../sources/libxbgi.a $(XTOOLLIB) $(XPMLIB) $(XLIB)

#endif /* DoSharedLib */

#endif /* defined(UseInstalledXBGI) */

#else /* !defined(BuildConcatenatedLib) */

#if defined(UseInstalledXBGI)

LOCAL_LIBRARIES = $(XBGILIB) $(XTOOLLIB) $(XPMLIB) $(XLIB)

#else /* !defined(UseInstalledXBGI) */

#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 /* !DoSharedLib */

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 /* DoSharedLib */

#endif /* defined(UseInstalledXBGI) */

#endif /* defined(BuildConcatenatedLib) */

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

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

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) $(TARGETS_CXX) 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) $< > $@

depend::
