# Makefile.  Generated from Makefile.in by configure.
# 



prefix      = /usr
exec_prefix = ${prefix}
bindir      = ${exec_prefix}/bin
libdir      = ${exec_prefix}/lib
includedir  = ${prefix}/include
mandir      = ${prefix}/man

BINNAME     = vipsi
TOP         = .
SRCDIR      = /home/pub/Develop/projects/vipsi/unix
SUBDIRS     =  ../../libraries/

SHELL       = /bin/sh
CC          = gcc
CFLAGS      =  -O2 -fsigned-char -Wno-multichar -W -Wall -Wundef -Wcast-align 
LDFLAGS     = 
LIBS        = -lm  -lstdc++
RM          = /bin/rm -f
TAR         = /bin/tar
SHTOOL      = $(TOP)/shtool
STRIP       = /usr/bin/strip

APXS        = 
AP_OBJ      = 

VERSION     = . ()
VERSION_S   = .

INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644


# root of all source
project_root = ../

# libraries folder
L = ../libraries
#L = $(project_root)/libraries  <-- no! move libraries/ into vipsi/ or make a link!

# projects/vipsi folder
P = ..

# headers included by kio.h
KH = $(L)/kio/*.h $(L)/cstrings/cstrings.h config.h $(P)/verrors.h $(L)/random/random.h

# all project and library headers
AH = $(P)/*.h $(KH) $(L)/prefs/prefs.h $(L)/unix/*.h $(L)/compress/freeze.h $(L)/ustring/sstring.h $(L)/var/var.h $(L)/utf-8/utf-8.h

# #include search path
I = -I . -I $(P) -I $(L)

# list of object files
OBJFILES = prefs.o var_test_suite.o sstring_test_suite.o file_utilities.o os_utilities.o freeze.o cstrings.o sstring.o utf-8.o var.o abort.o log.o errors.o main.o Stream.o SystemIO.o token.o VScript.o value.o execute.o $(AP_OBJ)


# =====	phony targets ========================================

# default make target:
#
# -----	compile and link program -----
#
vipsi: $(OBJFILES) Makefile
	$(CC) $(LDFLAGS) -o $(BINNAME) $(LIBS) $(OBJFILES)
	@$(STRIP) $(BINNAME)

mod_vipsi.so: $(OBJFILES)
	$(CC) -c -Wl,"$(LDFLAGS)" -o $(BINNAME) $(LIBS) $(OBJFILES)

# ----- install vipsi into /usr/bin/vipsi -----
#		priviledged operation; may require sudo!
#
install: $(BINNAME)
	./vipsi install.me
#	$(INSTALL_PROGRAM) -c -m 755 $(BINNAME) $(bindir)/$(BINNAME)
#	rm -f $(bindir)/calc
#	ln -s $(BINNAME) $(bindir)/calc

# -----	compile, link and install vipsi -----
#		may require sudo for installation!
#
all: $(BINNAME) install

# -----	clean-up -----
#		if you suspect bogus compilation/linkage due to a dependencies issue
#
clean:
	$(RM) *.o *~ $(P)/*~

# -----	create configuration files -----
#		remove file 'configure' and run this manually after you have modified any
#		input files for autoconf or autoheader.
#		creates "configure" and "config.h.in" for your co-developers.
#		note: dependencies not automated because of:
#			  this Makefile is also run by end users to build + install.
#			  this way end users and co-developers do not need autoconf.
#
configure:
	$(RM) config.h config.cache config.status config.log
	autoheader
	autoconf

# -----	create source distribution -----
#
dist: clean configure
	$(RM) Makefile
	$(SHTOOL) tarball -o vipsi-$(VERSION_S).tar.gz -d vipsi-$(VERSION_S) \
                          -e 'CVS,\.cvsignore,\.[ao],^\.' -c 'gzip --best' ./ ;
	# $(PWD)/$(project_root); \

# -----	do some testing -----
#
test:
	./vipsi -v $(project_root)/examples/test.vs



# ---- dependencies -------------------------------------

# libraries:

abort.o:$(KH) $(L)/kio/abort.*
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/kio/abort.cp

log.o:$(KH) $(L)/kio/log.*
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/kio/log.cp

errors.o:$(KH) $(L)/kio/errors.*
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/kio/errors.cp

file_utilities.o:$(KH) $(L)/unix/file_utilities.*
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/unix/file_utilities.cp

os_utilities.o:$(KH) $(L)/unix/os_utilities.*
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/unix/os_utilities.cp

freeze.o:$(KH) $(L)/compress/freeze.*
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/compress/freeze.cp

cstrings.o:$(KH) $(L)/cstrings/cstrings.*
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/cstrings/cstrings.cp

prefs.o:$(KH) $(L)/prefs/prefs.*
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/prefs/prefs.cp

sstring.o:$(KH) $(L)/ustring/sstring.*
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/ustring/sstring.cp

utf-8.o:$(KH) $(L)/utf-8/utf-8.cp $(L)/utf-8/*.h
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/utf-8/utf-8.cp

var.o:$(KH) $(L)/var/var.* $(L)/ustring/sstring.h
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/var/var.cp

sstring_test_suite.o:$(KH) $(L)/ustring/sstring.h $(L)/ustring/sstring_test_suite.cp
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/ustring/sstring_test_suite.cp

var_test_suite.o:$(KH) $(L)/var/var.h $(L)/ustring/sstring.h $(L)/var/var_test_suite.cp
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(L)/var/var_test_suite.cp

# project:
# (dependencies not yet fine tuned)

main.o:$(P)/main.cp $(AH)
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(P)/main.cp

Stream.o:$(P)/Stream.cp $(AH)
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(P)/Stream.cp

SystemIO.o:$(P)/SystemIO.cp $(AH)
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(P)/SystemIO.cp

token.o:$(P)/token.cp $(AH)
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(P)/token.cp

VScript.o:$(P)/VScript.cp $(AH)
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(P)/VScript.cp

value.o:$(P)/value.cp $(AH)
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(P)/value.cp

execute.o:$(P)/execute.cp $(AH)
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(P)/execute.cp

VT100.o:$(P)/VT100.cp $(AH)
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) $(P)/VT100.cp

mod_vipsi.o:$(P)/mod_vipsi.cp $(AH)
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $(I) -o mod_vipsi.cp


# autoconf/Makefile dependencies.               kio 2002-05-07
# based on the following diagram:
# (MacOS X dev docs for autoconf)

# Files used in preparing a software package for distribution:
#
# your source files --> [autoscan*] --> [configure.scan] --> configure.in
#
# configure.in --.   .------> autoconf* -----> configure
#                +---+
# [aclocal.m4] --+   `---.
# [acsite.m4] ---'       |
#                        +--> [autoheader*] -> [config.h.in]
# [acconfig.h] ----.     |
#                  +-----'
# [config.h.top] --+
# [config.h.bot] --'
#
# Makefile.in -------------------------------> Makefile.in
# 
# Files used in configuring a software package: 
# 
#                        .-------------> config.cache
# configure* ------------+-------------> config.log
#                        |
# [config.h.in] -.       v            .-> [config.h] -.
#                +--> config.status* -+               +--> make*
# Makefile.in ---'                    `-> Makefile ---'

config.status:configure config.h.in Makefile.in
	./configure

Makefile:config.status
	./config.status

config.h:config.status
	./config.status 
	touch config.h



