# Generated automatically from Makefile.in by configure.
# Generated automatically from Makefile.in by configure.
# Library Makefile for GNU Smalltalk
# Copyright (C) 1994, 1995 Free Software Foundation, Inc.
# Written by Steve Byrne

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# $Revision: 1.10 $

# OS/2 doesn't like this line
SHELL = /bin/sh

# .SUFFIXES : .obj .h .c   # OS/2 w/gnu make needs this

#### Start of system configuration section. ####

srcdir = .

PROGS = gst

MAINTAINER = 'sbb@gnu.ai.mit.edu'
# Uncomment these lines to enable the ultra-winning readline-reader
#READLINEDIR = ./readline	      # <-- set this appropriately
#READLINE = -DUSE_READLINE -DREADLINEDIRDEF=$(READLINEDIR)
READLINE = @READLINE@

# Uncomment these lines to enable the use of the GNU dynamic linking package
#DLDDIR = /usr/gnu/dld
#DLDDIR = ./dld
#DLD = -DUSE_DLD -DDLDDIRDEF=$(DLDDIR)

COMPILE_TYPE = # Normal case
#COMPILE_TYPE = -DOPTIMIZE
#COMPILE_TYPE = -DPROFILE

# If you use gcc, you should either run the fixincludes script that
# comes with it or else use gcc with the -traditional option.  Otherwise
# ioctl calls will be compiled incorrectly on some systems.
CC = cc		# on OS/2, icc is available
# Older makes don't set $(MAKE), so we set it for them.

BISON = bison
# Use cp if you don't have install.
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
AR = ar
RANLIB = ranlib   # ranlib  is not defined on OS/2
ALLOCA =    # alloca doesn't seem to need to be defined for OS/2

DEFS = -DHAVE_CONFIG_H
LIBS =  -lm    # on OS/2, we don't need -lm 
#LIBPROGS = @LIBPROGS@
MAKEINFO = :

GST_TAB=gst.tab
RM=rm -f

OBJ=o
LIB=a

# optimization flag -- may become host dependent
OPT_FLAG = -O
CDEBUG = -g
USER_OBJECTS = @USER_OBJECTS@

### This should be fixed to be part of  the autoconf stuff.
#DEFAULT_LIBRARIES = -m

INCLUDES=-I$(srcdir)/.. -I$(srcdir) 
CPPFLAGS = 
CFLAGS =  # $(INCLUDES)
LDFLAGS = 
LIBOBJS =  strdup.o putenv.o
GCC_EXTRA_FLAGS = -Wimplicit -Wreturn-type -Wunused 
# ICC_EXTRA_FLAGS = /c /Fo$@ /D__EXTENDED__  # flags for ICC

prefix = /usr/local
exec_prefix = ${prefix}

# Where to install the executables.
bindir = $(exec_prefix)/bin

# Where to put the system-wide image file
libdir = $(prefix)/lib
smlibdir = $(libdir)/smalltalk

## Where to put the manual pages.
#mandir = $(prefix)/man

# Where to put the info pages
infodir = $(prefix)/info

# Where to put include files
includedir = $(prefix)/include

#### End of system configuration section. ####

MDEFINES = bindir='$(bindir)' libdir='$(libdir)' mandir='$(mandir)' \
INSTALL='$(INSTALL)' INSTALLDATA='$(INSTALLDATA)' \
LIBS='$(LIBS)' LIBPROGS='$(LIBPROGS)' MAKE='$(MAKE)' \
AR='$(AR)' RANLIB='$(RANLIB)' \
BISON='$(BISON)' CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \
CC='$(CC)' INCLUDES='$(INCLUDES)' DEFS='$(DEFS)' CDEBUG='$(CDEBUG)' \
GCC_EXTRA_FLAGS='$(GCC_EXTRA_FLAGS)' GST_TAB='$(GST_TAB)' RM='$(RM)'

GENERIC_CC = $(CC) -c $(CPPFLAGS) $(DEFS) $(INCLUDES) $(GCC_EXTRA_FLAGS) $(CFLAGS) $(CDEBUG) 
# here's the OS/2 definition
# GENERIC_CC = $(CC) -c $(CPPFLAGS) $(DEFS) $(INCLUDES) $(GCC_EXTRA_FLAGS) $(CFLAGS) $(ICC_EXTRA_FLAGS) $(CDEBUG) 



COMMON_LIBS = $(READLINE) $(DLD) 

# This controls the distribution version (not completely yet)
VERSION = 1.2.alpha5

# Subdirectories to run make in for the primary targets.
###SUBDIRS = lib src man doc examples contrib
# Only make TAGS/tags files in these directories, in this order
###TSUBDIRS= src lib

OBJECTS = lib.$(OBJ)	$(GST_TAB).$(OBJ)   lex.$(OBJ)    str.$(OBJ) \
	id.$(OBJ)     tree.$(OBJ)   byte.$(OBJ)   interp.$(OBJ) comp.$(OBJ) \
	sym.$(OBJ)    dict.$(OBJ)   oop.$(OBJ)    save.$(OBJ)   cint.$(OBJ) \
	sysdep.$(OBJ) callin.$(OBJ) cfuncs.$(OBJ) $(LIBOBJS) $(USER_OBJS) $(ALLOCA)

# this isn't complete...I've renamed the .o files to be .OBJ, making lib happy.
# ultimately, we probably should just build .OBJ files for OS/2
LIBOBJECTS = +lib + $(GST_TAB) + lex + str \
	id + tree + byte + interp + comp + \
	sym + dict + oop + save + cint + \
	sysdep + callin + cfuncs

SOURCES = lib.c	$(GST_TAB).c   lex.c    str.c \
	id.c	    tree.c   byte.c   interp.c comp.c \
	sym.c    dict.c   oop.c    save.c   cint.c \
	sysdep.c callin.c cfuncs.c strdup.c putenv.c

HEADERS = gst.h lib.h $(GST_TAB).h lex.h str.h \
	id.h tree.h byte.h interp.h comp.h \
	sym.h dict.h oop.h save.h cint.h \
	sysdep.h callin.h gstpub.h 

DISTFILES = $(SOURCES) $(HEADERS) gst.y Makefile.in gstpaths.h.in \
	alloc.c alloca.c alloca.s 

# LIBS =  $(DEFAULT_LIBRARIES) $(USER_LIBS) $(READLINELIB) $(DLDLIB)


all: libgst.$(LIB)


.c.$(OBJ): 
	$(GENERIC_CC) $<

     
# deliberately not using $(LIB) here
libgst.a: $(OBJECTS)
	$(RM) $@
	$(AR) cr $@ $(OBJECTS)
	-$(RANLIB) $@

# OS/2 definition
#libgst.$(LIB): $(OBJECTS)
#	-$(RM) $@
#	lib $@ $(LIBOBJECTS);
##	-$(RANLIB) $@




optimize:
	echo $(CFLAGS)
	$(MAKE) CFLAGS="-DOPTIMIZE $(OPT_FLAG) $(CFLAGS)" CDEBUG=

clean:
	-$(RM) *.$(OBJ) core
	-$(RM) libgst.$(LIB)

install: all 
	$(INSTALL_DATA) libgst.$(LIB) $(smlibdir)/libgst.$(LIB)
	$(INSTALL_DATA) gst.h $(includedir)/gst.h
	$(INSTALL_DATA) gstpub.h $(includedir)/gstpub.h
	$(INSTALL_DATA) config.h $(includedir)/config.h

uninstall:


$(OBJECTS): ../config.h

$(GST_TAB).h $(GST_TAB).c: gst.y
	$(BISON) -dv gst.y

lib.$(OBJ) lex.c: $(GST_TAB).h

lex.$(OBJ): $(GST_TAB).h

# These depend on the oop table size 
save.$(OBJ) oop.$(OBJ) lib.$(OBJ) sym.$(OBJ): oop.h

# !!! figure out how to make this work
##if defined(SUNOS40) && defined(OPTIMIZE)
#mstinterp.$(OBJ): mstinterp.c
#	$(CC) -O2 -DOPTIMIZE $(EXTRA_PACKAGES) -c mstinterp.c
##endif

# !!! Clean these up in the future 

gst.h: ../config.h
	touch gst.h

comp.h: interp.h
	touch comp.h


lib.$(OBJ): gst.h
lib.$(OBJ): $(GST_TAB).h
lib.$(OBJ): interp.h
lib.$(OBJ): comp.h
lib.$(OBJ): save.h
lib.$(OBJ): sym.h
lib.$(OBJ): oop.h
lib.$(OBJ): gstpaths.h
lib.$(OBJ): lib.h
lib.$(OBJ): cint.h
lib.$(OBJ): callin.h
lib.$(OBJ): lex.h
lib.$(OBJ): dict.h

$(GST_TAB).$(OBJ): gst.h
$(GST_TAB).$(OBJ): sym.h
$(GST_TAB).$(OBJ): tree.h
$(GST_TAB).$(OBJ): dict.h
$(GST_TAB).$(OBJ): comp.h
$(GST_TAB).$(OBJ): lex.h


lex.$(OBJ): gst.h
lex.$(OBJ): lex.h
lex.$(OBJ): $(GST_TAB).h
lex.$(OBJ): str.h
lex.$(OBJ): id.h
lex.$(OBJ): dict.h
lex.$(OBJ): comp.h
lex.$(OBJ): tree.h
lex.$(OBJ): sysdep.h
lex.$(OBJ): gstpaths.h

str.$(OBJ): gst.h
str.$(OBJ): str.h

id.$(OBJ): str.h
id.$(OBJ): id.h

tree.$(OBJ): gst.h
tree.$(OBJ): sym.h
tree.$(OBJ): tree.h
tree.$(OBJ): lex.h

byte.$(OBJ): gst.h
byte.$(OBJ): byte.h
byte.$(OBJ): lex.h
byte.$(OBJ): sym.h
byte.$(OBJ): dict.h

interp.$(OBJ): gst.h
interp.$(OBJ): interp.h
interp.$(OBJ): dict.h
interp.$(OBJ): sym.h
interp.$(OBJ): oop.h
interp.$(OBJ): save.h
interp.$(OBJ): comp.h
interp.$(OBJ): cint.h
interp.$(OBJ): sysdep.h
interp.$(OBJ): lex.h
interp.$(OBJ): lib.h
interp.$(OBJ): byte.h

comp.$(OBJ): gst.h
comp.$(OBJ): sym.h
comp.$(OBJ): comp.h
comp.$(OBJ): tree.h
comp.$(OBJ): byte.h
comp.$(OBJ): dict.h
comp.$(OBJ): oop.h
comp.$(OBJ): interp.h
comp.$(OBJ): lex.h
comp.$(OBJ): sysdep.h

sym.$(OBJ): gst.h
sym.$(OBJ): sym.h
sym.$(OBJ): oop.h
sym.$(OBJ): comp.h
sym.$(OBJ): dict.h
sym.$(OBJ): tree.h
sym.$(OBJ): lex.h

sysdep.$(OBJ): gst.h
sysdep.$(OBJ): sysdep.h

dict.$(OBJ): gst.h
dict.$(OBJ): dict.h
dict.$(OBJ): oop.h
dict.$(OBJ): interp.h
dict.$(OBJ): str.h
dict.$(OBJ): sym.h
dict.$(OBJ): lib.h
dict.$(OBJ): lex.h
dict.$(OBJ): gstpub.h

oop.$(OBJ): gst.h
oop.$(OBJ): oop.h
oop.$(OBJ): dict.h
oop.$(OBJ): save.h
oop.$(OBJ): comp.h
oop.$(OBJ): callin.h
oop.$(OBJ): lex.h
oop.$(OBJ): sym.h

save.$(OBJ): gst.h
save.$(OBJ): save.h
save.$(OBJ): comp.h
save.$(OBJ): interp.h
save.$(OBJ): dict.h
save.$(OBJ): sym.h
save.$(OBJ): oop.h
save.$(OBJ): lib.h
save.$(OBJ): lex.h
save.$(OBJ): cint.h

cint.$(OBJ): gst.h
cint.$(OBJ): interp.h
cint.$(OBJ): dict.h
cint.$(OBJ): oop.h
cint.$(OBJ): sym.h
cint.$(OBJ): callin.h
cint.$(OBJ): lex.h

callin.$(OBJ): gst.h
callin.$(OBJ): lib.h
callin.$(OBJ): interp.h
callin.$(OBJ): callin.h
callin.$(OBJ): dict.h
callin.$(OBJ): sym.h
callin.$(OBJ): oop.h
callin.$(OBJ): comp.h
callin.$(OBJ): lex.h

cfuncs.$(OBJ): gst.h

#
# Install the files into the proper place
#

#install: all
#	echo "install not ready"
#	if test ! -d KERNEL_PATH ; then      \
#	    mkdir -p KERNEL_PATH ;           \
#	fi
#	cp *.st KERNEL_PATH
#	(cd KERNEL_PATH; chmod +r *.st)
#	if test ! -d IMAGE_PATH ; then      \
#	    mkdir -p IMAGE_PATH ;           \
#	fi
#	(x=`pwd`; cd IMAGE_PATH; $$x/gst -Vi)


########################################
# This stuff is commented out because I don't know whether it makes sense to do
# in a subdirectory
#configure: configure.in # not yet: aclocal.m4
#	cd ${srcdir} && autoconf
#     
## autoheader might not change config.h.in
#config.h.in: stamp-h.in
#stamp-h.in: configure.in acconfig.h # not yet: config.h.top aclocal.m4
#	cd ${srcdir} && autoheader
#	touch ${srcdir}/stamp-h.in
#     
## config.status might not change config.h
#config.h: stamp-h
#stamp-h: config.h.in config.status
#	./config.status
#	touch stamp-h
#     
#Makefile: Makefile.in config.status
#	./config.status
#     
#config.status: configure
#	./config.status --recheck
#

#configure: configure.in config.h.in Makefile.in
#	autoconf
#
#config.h.in: acconfig.h
#	autoheader
##ensure that this is marked as changed.
#	touch config.h.in


dist:
	ln $(DISTFILES) $(dist_target)

dist_missing:
	@test -f .ok-nodist-files || touch .ok-nodist-files
	@rlog -R RCS/* | sed -e 's;RCS/\(.*\),v;\1;' | sort > .rcs-files
	@for file in $(DISTFILES); do \
	    echo $$file  ; \
	done | \
	sort | comm -23 .rcs-files - | \
	    comm -23 - .ok-nodist-files
	
# ci_version should be set on the command line
ci_r:
	ci -l -mVersioning "-N$(ci_version)" RCS/*

#----------- THE BARRIER ---------------
# Stuff below has not be integrated into the makefile yet

profile:
	make CFLAGS='$(CFLAGS) -pg -Dprofiling'




tags:
.PHONY: tags

TAGS:

ls:
.PHONY: ls

#clean:
#	@for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $(MDEFINES) $@ || exit 1; cd ..; done
#.PHONY: clean

distclean:
	@for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $(MDEFINES) $@ || exit 1; cd ..; done
	-$(RM) Makefile config.status tags TAGS
.PHONY: distclean

realclean:
	@for dir in $(SUBDIRS); do echo making $@ in $$dir; cd $$dir; $(MAKE) $(MDEFINES) $@ || exit 1; cd ..; done
	-$(RM) Makefile config.status tags TAGS
.PHONY: realclean


# Tell versions [3.59, 3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
