Make.proto
author Claus Gittinger <cg@exept.de>
Tue, 19 Oct 1999 23:32:52 +0200
changeset 393 ae610c970310
parent 384 e516fa60a3f9
child 398 bbb3ba0bb33d
permissions -rw-r--r--
*** empty log message ***

#
# $Header$
#
# -------------- no need to change anything below ----------
#
# This makefile generates the smalltalk executable itself;
# it can be invoked as:
#
#    make
#       generates a standard smalltalk, and sets up symbolic links
#       for local execution.
#
#    make smalltalk
#       generates a standard smalltalk executable only
#
#    make stx_static (ELF based systems only):
#       generates a smalltalk with statically linked
#       class libs. (still uses dynamic unix libraries)
#
#    make stx_fullstatic (ELF based systems only):
#       generates a fully statically linked smalltalk
#       (even system libs are linked in)
#
#    make smalltalk ADDITIONAL_OBJS=<list of object files> \
#                   ADDITIONAL_CLASSES=<list of class names>
#       generates a customized executable, containing additional
#       class (list of classes) which are to be found in the object
#       files (list of object files).
#       Example:
#           make smalltalk ADDITIONAL_OBJS=Foo.o ADDITIONAL_CLASSES=Foo
#

TOP=../..
SUBDIRS=
SUPPRESS_LOCAL_ABBREVS="yes"

RCSSOURCES=*.rc patches Make.proto
LINKSOURCES=*.rc patches Make.proto

DELIVERBINARIES=stx

#
# other definitions to use for things compiled here
#
LOCALDEFS=-DDEBUG
# ST_LDFLAG=

# st files found here wont go into the global abbrev list
SUPPRESS_LOCAL_ABBREVS=1

#
# see COMMON/defines for what those XXX_LIB etc. are
#
# MINI_LIB        = libbasic, libcomp $(PRIVATELIBS)
# FUNDAMENTAL_LIB = above PLUS libview, libwidg
# DEVELOP_LIB     = above PLUS libtool
# STANDARD_LIB    = above PLUS libwidg2, libdbase
# EXTENDED_LIB    = above PLUS libwidg3

#
# this defines where the show starts
#
STARTUP_CLASS="Smalltalk"
STARTUP_SELECTOR="start"

#
# directories from which bitmap files in bitmap subdirectories are to be symlinked
# to the bitmaps subdirectory
# The default lists all relevant dirs.
#
# BITMAPLINK_DIRS= ... 

#
# you may add additional bitmap dirs here
#
# EXTRA_BITMAPLINK_DIRS= ...

#
# directories from which resource files are to be symlinked 
# to the resources subdirectory
# The default lists all relevant dirs.
#
# RESOURCELINK_DIRS= ... 

#
# directories from which binary files are to be symlinked 
# to the binary subdirectory
# The default lists all relevant dirs.
#
# BINARYLINK_DIRS= ...
# EXTRA_BINARYLINK_DIRS= ...

#
# directories from which source files are to be symlinked 
# to the source subdirectory
# The default lists all relevant dirs.
#
# SOURCELINK_DIRS= ...
# EXTRA_SOURCELINK_DIRS= ...

#
# including your own private lib in the make process and executable:
#
# for example, if you have a libprivate directory,
# where libprivate.obj is built, and that one should be included,
# add lines as below to your configuration/.../defines file:
#    PRIVATEOBJ=$(TOP)/libprivate/libprivate.obj
#    PRIVATE_SO=$(TOP)/libprivate/libprivate.so
#    PRIVATELIBS=libprivate

# ---------------------- end additional stuff --------------------


#
# default target: create the TARGET (usually smalltalk),
#                 create subdirectories with source-links, bitmap-links and resource-links
#
all::   $(TARGET)$(TARGET_RULE_EXTENSION) symlinks
	@-if [ "$(ALSO_MAKE_STATIC_TARGET)" = "1" ]; then \
	    mv stx stx_dynamic; \
	    $(MAKE) stx_fullstatic; \
	fi

#
# same, force recreation of link-directories
#
allNew: $(TARGET)$(TARGET_RULE_EXTENSION) newResources styles newSource newBitmaps binary newInclude misc
	@-if [ "$(ALSO_MAKE_STATIC_TARGET)" = "1" ]; then \
	    mv stx stx_dynamic; \
	    $(MAKE) stx_fullstatic; \
	fi

#
# create symbolic links to sources, resources etc.
# normally (on an end-user system) these should go into usr/local/lib/smalltalk
#
symlinks:   resourceLink styleLink newSource bitmapLink binaryLink includeLink misc

#
# the standard smalltalk executable:
# basic classes + view & widgets + tools + persistency
#
xsmalltalk:  $(TARGET)

smalltalk:: $(TARGET)$(TARGET_RULE_EXTENSION)

#
# demo for a graphical standAlone application (simply opening a FileBrowser)
#
fbrowser:
	    -rm -f main.o modulList.*
	    $(MAKE) main.o \
		STARTUP_CLASS="FileBrowser" \
		STARTUP_SELECTOR="open" \
		MAIN_DEFINES="-DIGNORE_IMAGE"
	    $(MAKE) linkTarget TARGET=fbrowser
	    -rm -f main.o modulList.*

#
# demo for a non-graphical standAlone application (simply prints 'hello world')
# demoApps have been moved into a separate directory.
# See more in ../demoApps
#
demoApp1:   DemoApp1.o
	    $(MAKE) NON_GUI_APPLICATION \
			TARGET=demoApp1 \
			APPLICATION_CLASSES="DemoApp1" \
			APPLICATION_OBJS="DemoApp1.o" \
			STARTUP_CLASS="DemoApp1" \
			STARTUP_SELECTOR="start" \
			MAIN_DEFINES="-DIGNORE_IMAGE"

DemoApp1.o:: DemoApp1.st

DemoApp1.st: ../demoApps/DemoApp1.st
	    -cp ../demoApps/DemoApp1.st .

#
# a testtalk with additional classes builtIn
# the following rule is now obsolete (JPEGReader is already builtIn)
# however, it can be used as a guide for your own additional classes
#
MY_ADDITIONAL_OBJECTS=JPEGReader.$(O)
MY_ADDITIONAL_CLASSES=JPEGReader
MY_ADDITIONAL_LIBS=../../support/libjpeg/libjpeg.a

mySmalltalk: $(MY_ADDITIONAL_OBJECTS)
	@echo "making special smalltalk ..."
	@$(MAKE) linkIt \
		LIBOBJS="$(LIBOBJS)" \
		LINK_OBJS="$(LINK_OBJS)" \
		LINK_LIBOBJS="$(LINK_LIBOBJS)" \
		LINK_LIBRUN="$(LINK_LIBRUN)" \
		LIBRUN="$(LIBRUN)" \
		ADDITIONAL_OBJS=$(MY_ADDITIONAL_OBJECTS) \
		ADDITIONAL_CLASSES=$(MY_ADDITIONAL_CLASSES) \
		ADDITIONAL_LIBS=$(MY_ADDITIONAL_LIBS) \
		EXTRA_OBJ="$(EXTRA_OBJ)" \
		EXTRA_LINK_OBJ="$(EXTRA_LINK_OBJ)" \
		LIBLIST="$(LIBLIST)"
	@$(MAKE) removeLinkLibs

#
# by default, the TARGET rule calls for one of the
# rules below. Which one is controlled by the
# architecture-specific definition file.
#
$(TARGET)_static: $(STATIC_LIBRUN)
	@echo "making statically linked smalltalk ..."
	@$(MAKE) linkIt \
		LIBOBJS="" \
		LINK_OBJS="$(STATIC_OBJS)" \
		LINK_LIBOBJS="$(STATIC_LIBOBJS)" \
		LINK_LIBRUN="$(STATIC_LIBRUN)" \
		LIBRUN="$(STATIC_LIBRUN)" \
		ADDITIONAL_OBJS=$(STATIC_ADDITIONAL_OBJS) \
		ADDITIONAL_CLASSES=$(STATIC_ADDITIONAL_CLASSES) \
		EXTRA_OBJ="$(STATIC_EXTRA_OBJ)" \
		EXTRA_LINK_OBJ="$(STATIC_EXTRA_OBJ)" \
		LIBLIST="$(LIBLIST)"
	@$(MAKE) removeLinkLibs

$(TARGET)_shared:
	@echo "making shared library linked smalltalk ..."
	@$(MAKE) linkIt \
		LIBOBJS="$(LIBOBJS)" \
		ADDITIONAL_OBJS=$(ADDITIONAL_OBJS) \
		ADDITIONAL_CLASSES=$(ADDITIONAL_CLASSES) \
		EXTRA_OBJ="$(EXTRA_OBJ)" \
		EXTRA_LINK_OBJ="$(EXTRA_LINK_OBJ)" \
		LIBRUN=$(LIBRUN) \
		LINK_LIBRUN=$(LINK_LIBRUN) \
		LIBLIST="$(LIBLIST)"

$(TARGET)_fullstatic: $(STATIC_LIBRUN)
	if [ -f $(LIBRUNDIR)/librun.a ]; then \
	    echo "librun.a already made."; \
	else \
	    (cd $(LIBRUNDIR); make librun.a); \
	fi
	@echo "making full statically linked smalltalk ..."
	@$(MAKE) linkIt \
		LIBOBJS="" \
		LINK_OBJS="$(STATIC_OBJS)" \
		LINK_LIBOBJS="$(STATIC_LIBOBJS)" \
		LINK_LIBRUN="$(STATIC_LIBRUN)" \
		LIBRUN="$(STATIC_LIBRUN)" \
		ADDITIONAL_OBJS=$(STATIC_ADDITIONAL_OBJS) \
		ADDITIONAL_CLASSES=$(STATIC_ADDITIONAL_CLASSES) \
		EXTRA_OBJ="$(STATIC_EXTRA_OBJ)" \
		EXTRA_LINK_OBJ="$(STATIC_EXTRA_OBJ)" \
		LIBLIST="$(LIBLIST)" \
		MATHLIB="$(STATIC_MATHLIB)" \
		EXTRA_LIBS="$(STATIC_EXTRA_LIBS)" \
		SYSLIBS="$(STATIC_SYSLIBS)"

	@$(MAKE) removeLinkLibs

AIX_SHARED_LIBOBJS= \
	$(LIBBASICDIR)/libbasic.so \
	$(LIBCOMPDIR)/libcomp.so \
	$(LIBVIEWDIR)/libview.so \
	$(LIBVIEW2DIR)/libview2.so \
	$(LIBWIDGDIR)/libwidg.so \
	$(LIBTOOLDIR)/libtool.so \
	$(LIBBASIC2DIR)/libbasic2.so \
	$(LIBBASIC3DIR)/libbasic3.so \
	$(LIBHTMLDIR)/libhtml.so \
	$(LIBWIDG2DIR)/libwidg2.so \
	$(PERSDIR)/libdbase.so

aix:
	    @echo "making shared library linked smalltalk for aix ..."
	    @$(MAKE) linkIt \
		LIBOBJS="$(AIX_SHARED_LIBOBJS)" \
		EXTRA_OBJ="$(EXTRA_OBJ)" \
		EXTRA_LINK_OBJ="$(EXTRA_LINK_OBJ)" \
		LIBLIST="$(LIBLIST)" \
		LINK_LIBRUN=$(LINK_LIBDIR)librun.so \
		LIBRUN=$(LIBRUNDIR)/librun.so

aix_librun_only:
	    @echo "making partial shared library linked smalltalk ..."
	    @$(MAKE) linkIt LIBRUN=$(LIBRUNDIR)/librun.so

forceStatic:
	    (cd $(LIBBASICDIR) ; make libbasicInit.o)
	    -rm -f $(LIBBASICDIR)/libbasic.o
	    $(MAKE) linkIt LIBRUN="$(LIBRUNDIR)/*.o" LIBBASIC="$(LIBBASICDIR)/*.o"

#
# a "smaller" smalltalk (does not include development classes)
#
smalltalk_exec:
	    -rm -f modulList.stc
	    @$(MAKE) modulList.stc \
		EXTRA_CLASSES="$(EXTRA_CLASSES) DebugView" \
		EXTRA_OBJ="$(EXTRA_OBJ) $(LIBTOOLDIR)/DebugView$(BIN_O)" \
		LIBLIST="$(FUNDAMENTAL_LIST)"
	    @$(MAKE) smalltalk \
		LIBLIST="$(FUNDAMENTAL_LIST)" \
		EXTRA_CLASSES="$(EXTRA_CLASSES) DebugView" \
		EXTRA_OBJ="$(EXTRA_OBJ) \
		EXTRA_LINK_OBJ="$(EXTRA_LINK_OBJ)" \
		$(LIBTOOLDIR)/DebugView$(BIN_O)" \
		LIBOBJS="$(FUNDAMENTAL_LIB)"
	    if [ ! -f binary/DebugView$(BIN_O) ]; then \
		rm -f binary/DebugView.so;                              \
		(cd binary ; ln -s ../../../libtool/DebugView.so .);    \
	    fi

$(LIBTOOLDIR)/DebugView.so:
	    (cd $(LIBTOOLDIR) ; $(MAKE) DebugView.so)

$(LIBTOOLDIR)/DebugView.o:
	    (cd $(LIBTOOLDIR) ; $(MAKE) DebugView.o)

$(LIBVIEWDIR)/XWorkstation.o:
	    (cd $(LIBVIEWDIR) ; $(MAKE) XWorkstation.o)

$(LIBVIEWDIR)/XWorkstation.so:
	    (cd $(LIBVIEWDIR) ; $(MAKE) XWorkstation.so)

$(LIBVIEWDIR)/GLXWorkstation.o:
	    (cd $(LIBVIEWDIR) ; $(MAKE) GLXWorkstation.o)

$(LIBVIEWDIR)/GLXWorkstation.so:
	    (cd $(LIBVIEWDIR) ; $(MAKE) GLXWorkstation.so)

$(LIBCOMPDIR)/ObjectFileLoader.o:
	    (cd $(LIBCOMPDIR) ; $(MAKE) ObjectFileLoader.o)

$(LIBCOMPDIR)/ObjectFileLoader.so:
	    (cd $(LIBCOMPDIR) ; $(MAKE) ObjectFileLoader.so)

$(LIBRUNDIR)/librun.a:
	if [ -f $(LIBRUNDIR)/librun.a ]; then \
	    echo "librun.a already made."; \
	else \
	    (cd $(LIBRUNDIR); make librun.a); \
	fi

#
# make list of classes for a standard smalltalk
# (includes basic, view & widgets and Persistency)
#
BASICLIST:   $(CLASSLISTS)
	    -cat $(CLASSLISTS) > $(CLASSLIST)

#
# dont want these ttt-tempfile abbrevs to be included ...
#
abbrev.stc::
	    @-rm -f ttt*.*

#
# currently, abbrev,stc must be made cross
#
ntAbbrev.stc: include/abbrev.stc
	cp include/abbrev.stc ntAbbrev.stc

#
# dont want local abbrevs to be included ...
#
collectAbbrev::
	    @-rm -f abbrev.stc
	    @-if [ -d include ]; then \
		if [ ! -f include/abbrev.stc ]; then \
		    (cd include; $(LNS) ../$(INCLUDE)/abbrev.stc . );   \
		fi;                                                     \
	    fi

collectAutoload::
	    @-rm -f autoloadList.stc
	    @-if [ -d include ]; then \
		if [ ! -f include/autoloadList.stc ]; then \
		    (cd include; $(LNS) ../$(INCLUDE)/autoloadList.stc . ); \
		fi;                                                             \
	    fi

classes::
	    test -d classes || mkdir classes
	    -for i in source/*.st; do \
		stcomp -i stcomp.img $$i; \
	    done

#
# make a new source subdirectory
# the source directory consists of sym-links to all .st files we find
#
newSource:
	    -rm -rf source
	    @-$(MAKE) sourceLink

Source:     source

source:     
	    @-$(MAKE) sourceLink

sourcelink::  sourceLink
        
#
# make a new include subdirectory and link to abbreviation file
newInclude:
	    -rm -rf include
	    @-$(MAKE) includeLink

includelink:: includeLink
        

misc:       examples

examples:
	    test -d examples || mkdir examples examples/3D
	    -(cd examples/3D; $(LNS) ../../$(TOP)/clients/GLdemos/*.data . 2> /dev/null)

#
# make a new binary subdirectory
# (this is only useful on systems that support dynamic loading;
#  autoloaded classes will then be loaded from machine code files
#  instead of source)
#
newBinary:
	    -rm -rf binary
	    @-$(MAKE) binaryLink

binary:
	    @-$(MAKE) binaryLink

binarylink:: binaryLink

#
# make a new bitmaps subdirectory
# (simply collect the contents of all bitmap directories)
#
newBitmaps:
	    -rm -rf bitmaps
	    @-$(MAKE) bitmaps

Bitmaps:    bitmaps

bitmaps:    
	    @-$(MAKE) bitmapLink

bitmaplink:: bitmapLink

#
# clean out intermediate chunk
#
cleanjunk::
	    @-rm -f a.out SymbolTable ttt main.c
	    @-rm -f classList.c fclassList.c nxclassList.c basicclassList.c
	    @-rm -f betaclassList.c miniList.c tinyList.c
	    @-rm -f modulList.stc modulList.c modulList.o
	    @-rm -f pers* pers2 data data2 data.boss tetris.scores

cleanlinks:
	    @-rm -rf source bitmaps binaries resources examples include

#
# clean out all that is not needed to run smalltalk
#
clean::
	    @-rm -f a.out SymbolTable ttt main.c
	    @-rm -f modulList.stc modulList.c modulList.o
	    @-rm -f classList.stc classList.c classList.o
	    @-rm -f fclassList.stc fclassList.c
	    @-rm -f nxclassList.stc nxclassList.c
	    @-rm -f basicclassList.stc basicclassList.c
	    @-rm -f betaclassList.stc betaclassList.c
	    @-rm -f miniList.stc miniList.c
	    @-rm -f tinyList.stc tinyList.c
	    @-rm -f pers pers2 data data2 data.boss tetris.scores
	    @-rm -f st.img st2.img st.img.sav errorOutput
	    @-rm -f .stx*.mem symbols.h
	    @-rm -rf modules stxtmp*

#
# clean out all that can be regenerated
#
clobber::
	    @$(MAKE) removeLinkLibs
	    @-rm -f modulList.stc modulList.c modulList.o
	    @-rm -rf resources source binary bitmaps include examples lib
	    @-rm -f stx st.img st.img.sav st.sav
	    @-rm -f main.o symbols.h
	    @-rm -rf modules
	    @-rm -rf stxtmp_*

#
# make a new resources subdirectory
#
newResources:
	    rm -rf resources
	    @$(MAKE) resources styleLink

resources: 
	    test -d resources || mkdir resources
	    @$(MAKE) resourceLink

resourcelink: resourceLink


styles:     styleLink

main.o::    $(INCLUDE)/stc.h $(INCLUDE)/stcIntern.h Makefile $(INCLUDE)/symbols.stc symbols.h

#
# installation rules
#

install:: installThis

#
# install binary only
#
binInstall::
	test -d $(INSTALLBIN_DIR) || mkdir $(INSTALLBIN_DIR)
	$(INSTALL_BIN_CMD) smalltalk $(INSTALLBIN_DIR)
	$(INSTALL_BIN_CMD) stx $(INSTALLBIN_DIR)
	-strip $(INSTALLBIN_DIR)/stx

installThisSources:
	test -d $(INSTALLLIB_DIR)/source || mkdir $(INSTALLLIB_DIR)/source
	-chmod a+rx $(INSTALLLIB_DIR)/source
	-cp source/[A-G]* $(INSTALLLIB_DIR)/source
	-cp source/[H-P]* $(INSTALLLIB_DIR)/source
	-cp source/[Q-Z]* $(INSTALLLIB_DIR)/source
	-chmod a+r $(INSTALLLIB_DIR)/source/[A-G]*
	-chmod a+r $(INSTALLLIB_DIR)/source/[H-P]*
	-chmod a+r $(INSTALLLIB_DIR)/source/[Q-Z]*

installThisBitmaps:
	test -d $(INSTALLLIB_DIR)/bitmaps || mkdir $(INSTALLLIB_DIR)/bitmaps
	-chmod a+rx $(INSTALLLIB_DIR)/bitmaps
	-cp bitmaps/[A-I]* $(INSTALLLIB_DIR)/bitmaps
	-cp bitmaps/[J-Z]* $(INSTALLLIB_DIR)/bitmaps
	-cp bitmaps/[a-i]* $(INSTALLLIB_DIR)/bitmaps
	-cp bitmaps/[j-z]* $(INSTALLLIB_DIR)/bitmaps
	-chmod a+r $(INSTALLLIB_DIR)/bitmaps/[A-I]*
	-chmod a+r $(INSTALLLIB_DIR)/bitmaps/[J-Z]*
	-chmod a+r $(INSTALLLIB_DIR)/bitmaps/[a-i]*
	-chmod a+r $(INSTALLLIB_DIR)/bitmaps/[j-z]*

installThisResources:
	-chmod a+rx $(INSTALLLIB_DIR)/resources
	test -d $(INSTALLLIB_DIR)/resources || mkdir $(INSTALLLIB_DIR)/resources
	-cp resources/* $(INSTALLLIB_DIR)/resources
	-chmod a+r $(INSTALLLIB_DIR)/resources/*.rs

installRest:
	test -d $(INSTALLLIB_DIR)/doc || mkdir $(INSTALLLIB_DIR)/doc
	test -d $(INSTALLLIB_DIR)/doc/online || mkdir $(INSTALLLIB_DIR)/doc/online
	test -d $(INSTALLLIB_DIR)/doc/online/english || mkdir $(INSTALLLIB_DIR)/doc/online/english
	-chmod a+rx $(INSTALLLIB_DIR)/doc
	-chmod a+rx $(INSTALLLIB_DIR)/doc/online
	-chmod a+rx $(INSTALLLIB_DIR)/doc/online/english
	-cp $(TOP)/doc/online/english/LICENCE_STX.html $(INSTALLLIB_DIR)/doc/online/english
	-cp $(TOP)/doc/online/english/*.tiff $(INSTALLLIB_DIR)/doc/online/english
	-chmod a+r $(INSTALLLIB_DIR)/doc/online/english/*

#
# install all local stuff
#
# notice the [x-y]* patterns; some unixes (at&t) dont like too many arguments ...
#
installThis:: binInstall installRest
	test -d $(INSTALLLIB_DIR) || mkdir $(INSTALLLIB_DIR)
	$(MAKE) installThisSources
	$(MAKE) installThisBitmaps
	$(MAKE) installThisResources
	-cp *.rc *.stc patches $(INSTALLLIB_DIR)
	-chmod a+r $(INSTALLLIB_DIR)/*.rc $(INSTALLLIB_DIR)/*.stc $(INSTALLLIB_DIR)/patches

qinstall:: installThis