checkin from browser
authorClaus Gittinger <cg@exept.de>
Mon, 20 Sep 1999 16:36:21 +0200
changeset 4779 767b94dabb98
parent 4778 df6189d4909e
child 4780 35deaaafd9b1
checkin from browser
Project.st
--- a/Project.st	Mon Sep 20 15:53:23 1999 +0200
+++ b/Project.st	Mon Sep 20 16:36:21 1999 +0200
@@ -1401,7 +1401,7 @@
     ].
 
     out nextPutAll:'"/
-"/ $Header: /cvs/stx/stx/libbasic/Project.st,v 1.98 1999-09-20 12:57:14 cg Exp $
+"/ $' , 'Header' , '$
 "/
 "/ load-file to load code for: ' , self package , '
 "/
@@ -1457,54 +1457,22 @@
 !
 
 createMakefile
-    "creates an initial makefile, which will recreate a correct
-     Makefile, then compile all"
-
-    |d f out in topName|
+    "creates an initial Makefile from a Make.proto file.
+     Requires the stmkmf script"
+
+    |d top|
 
     Transcript showCR:'creating Makefile'.
 
-    d := directoryName asFilename.
-    f := d construct:'Makefile'.
-    f exists ifTrue:[
-        f renameTo:(d construct:'Makefile.bak')
-    ].
-    out := f writeStream.
-    out isNil ifTrue:[
-        self warn:'cannot create Makefile'.
-        ^ self
+    d := directoryName asFilename pathName.
+    top := (d , '/' , (self findTopFrom:directoryName)) asFilename pathName.
+
+    (OperatingSystem 
+        executeCommand:('sh ' , top , '/rules/stmkmf')
+        inDirectory:d) ifFalse:[
+        self warn:'Could not execute stmkmf - no Makefile built.'
     ].
-    in := Smalltalk systemFileStreamFor:'rules/stdHeader'.
-    out nextPutAll:in contents asString.
-    in close.
-
-    topName := self findTopFrom:directoryName.
-
-    out nextPutAll:'#TOP=/usr/local/lib/smalltalk'; cr.
-    out nextPutAll:'TOP=' , topName; cr.
-    out nextPutAll:'target:'; cr.
-    out tab; nextPutAll:'touch Make.proto'; cr.
-    out tab; nextPutAll:'$(MAKE) Makefile'; cr.
-    out tab; nextPutAll:'make'; cr; cr.
-
-    in := Smalltalk systemFileStreamFor:'configurations/COMMON/defines'.
-    out nextPutAll:in contents asString.
-    in close.
-
-    in := Smalltalk systemFileStreamFor:'configurations/vendorConf'.
-    out nextPutAll:in contents asString.
-    in close.
-
-    in := Smalltalk systemFileStreamFor:'configurations/myConf'.
-    out nextPutAll:in contents asString.
-    in close.
-
-    in := Smalltalk systemFileStreamFor:'rules/stdRules'.
-    out nextPutAll:in contents asString.
-    in close.
-    out close
-
-    "Modified: 18.5.1996 / 15:44:25 / cg"
+
 !
 
 createProjectFiles
@@ -1527,10 +1495,47 @@
     "creates a Make.proto file"
 
     |d f s type appName libName startUpClass startUpSelector
-     topName classes|
+     topName classes numBad firstBad msg|
+
+    classes := self classes.
+    numBad := 0.
+    firstBad := nil.
+
+    classes := classes collect:[:clsOrSymbol |  |cls|
+                                        clsOrSymbol isSymbol ifTrue:[
+                                            cls := Smalltalk at:clsOrSymbol.
+                                            cls isNil ifTrue:[
+                                                numBad := numBad + 1.
+                                                firstBad := firstBad ? clsOrSymbol.
+                                            ] ifFalse:[
+                                                cls isLoaded ifFalse:[
+                                                    cls autoLoad.
+                                                    cls isLoaded ifFalse:[
+                                                        cls := nil
+                                                    ]
+                                                ].
+                                            ].
+                                            cls.
+                                        ] ifFalse:[
+                                            clsOrSymbol
+                                        ]
+                              ].
+    numBad ~~ 0 ifTrue:[
+        msg := 'Cannot generate ''Make.proto''-file.\\'.
+        msg := msg , 'Reason: Class ''' , firstBad asText allBold
+                   , ''' is not loaded.'.
+        numBad ~~ 1 ifTrue:[
+            msg := msg , '\(' , (numBad-1) printString , ' more unloaded classes were found)'
+        ].
+        self warn:msg withCRs.
+        ^ self.
+    ].
+
+    classes := classes copy topologicalSort:[:a :b | b isSubclassOf:a].
 
     topName := self findTopFrom:directoryName.
 
+
     Transcript showCR:'creating Make.proto'.
 
     d := directoryName asFilename.
@@ -1543,115 +1548,218 @@
         self warn:'cannot create prototype Makefile'.
         ^ self
     ].
-    s nextPutAll:'#
-# ' , Smalltalk timeStamp , '
+    s nextPutAll:'# $' , 'Header' , '$
 #
-# created by Smalltalks Project support
+# -- Make.proto created from project at ' , Smalltalk timeStamp , '
 #
-
-
-# the next line defines the path to the TOP directory,
-# (where the directories "configurations" and "include" are found)
-#
-#TOP=/usr/local/lib/smalltalk
-TOP=' , topName ,'
+# Warning: once you modify this file, do not rerun
+# stmkmp or recreate the Make.proto again - otherwise, your changes are lost.
+
+# module and directory-in-module;
+# these should correspond to the directory hierarchy
+# location (otherwise, ST/X will have a hard time to
+# find out the packages location from its packageID)
+MODULE=' , self repositoryModule ? 'unknown' , '
+MODULE_DIR=' , self repositoryDirectory ? 'unknown' , '
+
+# default installation directory:
+# (overwrite with ''make INSTALLTOP_DIR=... install'')
+# the INSTALLBASE is imported from configurations... and usually
+# defaults to something like /opt/smalltalk.
+# (overwrite with ''make INSTALLBASE=... install'')
+INSTALLTOP_DIR=$(INSTALLBASE)/packages/$(MODULE)/$(MODULE_DIR)
+INSTALLLIB_DIR=$(INSTALLTOP_DIR)
+INSTALLBIN_DIR=$(INSTALLTOP_DIR)
 
 #
-# add any subdirectories that have to be visited by make
-#
+# position (of this package) in directory hierarchy:
+# (must point to ST/X top directory, for tools and includes)
+TOP=' , topName ,'
+
+# subdirectories where targets are to be made:
 SUBDIRS=
 
-#
-# do not change
+# subdirectories where Makefiles are to be made:
+# (only define if different from SUBDIRS)
+# ALLSUBDIRS=
+
+
+# the name of your classLibrary:
+# ********** REQUIRED: CHECK the next line ***
+LIBNAME=' , self name , '
+
+
+# the next define suppresses installation of 
+# the classes as autoloaded (i.e. not added to abbrev.stc). 
+SUPPRESS_LOCAL_ABBREVS=1
+
+# the package is stored as an ID in classes and methods
+# to identify code belonging to this project.
+# It also specifies the position in the source repository
+# and directory tree, when packages are loaded by packageID.
+# ********** REQUIRED: CHECK the next line ***
+PACKAGE=$(MODULE):$(MODULE_DIR)
+
+# Argument(s) to the stc compiler.
+#  -H.         : create header files locally
+#                (if removed, they will be created as common
+#  -Pxxx       : defines the package
+#  -Zxxx       : a prefix for variables within the classLib
+#  -Dxxx       : defines passed to to CC for inline C-code
+#  -Ixxx       : include path passed to CC for inline C-code
+#  +optspace   : optimized for space
+#  +optspace2  : optimized more for space
+#  +optspace3  : optimized even more for space
+#  +optinline  : generate inline code for some ST constructs
+#  +inlineNew  : additionally inline new
+#  +inlineMath : additionally inline some floatPnt math stuff
 #
-SHELL=/bin/sh
-
-'.
-
-    s nextPutAll:'#
-# set the stc options
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCLOCALOPTIMIZATIONS=+optinline +inlineNew
+# STCLOCALOPTIMIZATIONS=+optspace3
+STCLOCALOPTIMIZATIONS=+optspace3
+
+# Argument(s) to the stc compiler.
+#  -warn            : no warnings
+#  -warnNonStandard : no warnings about ST/X extensions
+#  -warnEOLComments : no warnings about EOL comment extension
+#  -warnPrivacy     : no warnings about privateClass extension
 #
-STCOPT=$(DEFAULT_STCOPT)
-# STCOPT=+optspace2
-# STCOPT=+optspace2 -warnNonStandard
-
-#
-# and packageName option
-#
-STCLOCALOPT=''-Pprivate-classes-(libapp)''
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCWARNINGS=-warn
+# STCWARNINGS=-warnNonStandard
+# STCWARNINGS=-warnEOLComments
+STCWARNINGS=
+
+# if your embedded C code requires any system includes, 
+# add the path(es) here:, 
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALINCLUDES=-Ifoo -Ibar
+LOCALINCLUDES=
+
+# if you need any additional defines for embedded C code, 
+# add them here:, 
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALDEFINES=-Dfoo -Dbar -DDEBUG
+LOCALDEFINES=
+
+STCLOCALOPT=-I. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALINCLUDES) $(LOCALDEFINES) -H. ''-P$(PACKAGE)'' ''-Z$(LIBNAME)'' $(COMMONSYMFLAG) $(INITCODESEPFLAG)
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C-libraries that should be pre-linked with the class-objects
+LD_OBJ_LIBS=
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C targets or libraries should be added below
+LOCAL_EXTRA_TARGETS=
+
+all:: preMake classLibRule postMake
+
 
 '.
 
-    type := #library.
-    appName := 'app'.
-    libName := 'lib'.
-    startUpClass := 'Smalltalk'.
-    startUpSelector := 'start'.
-
-    properties notNil ifTrue:[
-        type := properties at:#projectType ifAbsent:type.
-        appName := properties at:#applicationName ifAbsent:appName.
-        startUpClass := properties at:#startupClass ifAbsent:startUpClass.
-        startUpSelector := properties at:#startupSelector ifAbsent:startUpSelector.
-    ].
-
-    s nextPutAll:'#
-# define the name of the library to create
-#
-'.
-    s nextPutAll:'LIBNAME=lib' , appName; cr; cr.
-
-    s nextPutAll:'#
-# the target rule:
-#
-all::   abbrev.stc objs genClassList $(OBJTARGET)
-
-'.
-
-    type == #executable ifTrue:[
-        s nextPutAll:'PROGS = ' , appName; cr.
-        s nextPutAll:('STARTUP_CLASS=' , startUpClass); cr.
-        s nextPutAll:'STARTUP_SELECTOR="' , startUpSelector; nextPutAll:'"'; cr.
+"/    type := #library.
+"/    appName := 'app'.
+"/    libName := 'lib'.
+"/    startUpClass := 'Smalltalk'.
+"/    startUpSelector := 'start'.
+"/
+"/    properties notNil ifTrue:[
+"/        type := properties at:#projectType ifAbsent:type.
+"/        appName := properties at:#applicationName ifAbsent:appName.
+"/        startUpClass := properties at:#startupClass ifAbsent:startUpClass.
+"/        startUpSelector := properties at:#startupSelector ifAbsent:startUpSelector.
+"/    ].
+"/
+"/    s nextPutAll:'#
+"/# define the name of the library to create
+"/#
+"/'.
+"/    s nextPutAll:'LIBNAME=lib' , appName; cr; cr.
+"/
+"/    s nextPutAll:'#
+"/# the target rule:
+"/#
+"/all::   abbrev.stc objs genClassList $(OBJTARGET)
+"/
+"/'.
+"/
+"/    type == #executable ifTrue:[
+"/        s nextPutAll:'PROGS = ' , appName; cr.
+"/        s nextPutAll:('STARTUP_CLASS=' , startUpClass); cr.
+"/        s nextPutAll:'STARTUP_SELECTOR="' , startUpSelector; nextPutAll:'"'; cr.
+"/    ].
+"/
+"/    s nextPutAll:'#
+"/# define the object files that are to be created
+"/#
+"/'.
+    s nextPutAll:'OBJS='.
+
+    classes do:[:aClass |
+        |abbrev|
+
+        s nextPutAll:' \'. s cr.
+        abbrev := Smalltalk fileNameForClass:aClass name.
+        s nextPutAll:'  '; nextPutAll:abbrev; nextPutAll:'.$(O)'.
     ].
-
-    s nextPutAll:'#
-# define the object files that are to be created
-#
+    s cr.
+
+    s nextPutAll:'
+# add more install actions here
+install::
+
+# add more install actions for aux-files (resources) here
+installAux::
+
+# add more preMake actions here
+preMake::
+
+# add more postMake actions here
+postMake:: cleanjunk
+
+cleanjunk::
+
+clean::
+' , Character tab , '-rm -f *.o *.H
+
+clobber::
+' , Character tab , '-rm -f *.so *.dll
+
+$(INSTALLBASE)::
+' , Character tab , '@test -d $@ || mkdir $@
+
+$(INSTALLBASE)/packages:: $(INSTALLBASE)
+' , Character tab , '@test -d $@ || mkdir $@
+
+$(INSTALLBASE)/packages/$(MODULE):: $(INSTALLBASE)/packages
+' , Character tab , '@test -d $@ || mkdir $@
+
+$(INSTALLBASE)/packages/$(MODULE)/osi:: $(INSTALLBASE)/packages/$(MODULE)
+' , Character tab , '@test -d $@ || mkdir $@
+
+$(INSTALLBASE)/packages/$(MODULE)/osi/asn1:: $(INSTALLBASE)/packages/$(MODULE)/osi
+' , Character tab , '@test -d $@ || mkdir $@
+
+$(INSTALLBASE)/packages/$(MODULE)/$(MODULE_DIR):: $(INSTALLBASE)/packages/$(MODULE)
+' , Character tab , '@test -d $@ || mkdir $@
+
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
 '.
-    s nextPutAll:'OBJS='.
-
-    (classes := self classes) notNil ifTrue:[
-        classes do:[:aClass |
-            |abbrev|
-
-            s nextPutAll:' \'. s cr.
-            abbrev := Smalltalk fileNameForClass:aClass name.
-            s nextPutAll:'  '; nextPutAll:abbrev; nextPutAll:'.o'.
-        ].
-    ].
-    s cr; cr.
-
-    s nextPutAll:'#
-# dependencies:
-#
-I=$(TOP)/include
-RT_STUFF=$(I)/Object.H $(I)/stc.h $(I)/stcIntern.h
-
-'.
-    classes notNil ifTrue:[
-        classes do:[:aClass |
-            |abbrev|
-
-            abbrev := Smalltalk fileNameForClass:aClass name.
-            s nextPutAll:abbrev; nextPutAll:'.o: '.
-            s nextPutAll:abbrev; nextPutAll:'.st '.
-            aClass allSuperclassesDo:[:superClass|
-                s nextPutAll:'$(I)/'.
-                s nextPutAll:(Smalltalk fileNameForClass:superClass name) , '.H '.
-            ].
-            s nextPutAll:'$(RT_STUFF)';  cr.
-        ].
-    ].
+"/    classes notNil ifTrue:[
+"/        classes do:[:aClass |
+"/            |abbrev|
+"/
+"/            abbrev := Smalltalk fileNameForClass:aClass name.
+"/            s nextPutAll:abbrev; nextPutAll:'.$(O): '.
+"/            s nextPutAll:abbrev; nextPutAll:'.st '.
+"/            aClass allSuperclassesDo:[:superClass|
+"/                s nextPutAll:(Smalltalk fileNameForClass:superClass name) , '.$(H) '.
+"/            ].
+"/            s nextPutAll:'$(STCHDR)';  cr.
+"/        ].
+"/    ].
+    s nextPutAll:'# ENDMAKEDEPEND --- do not remove this line'.
     s cr; cr.
 
     type == #executable ifTrue:[
@@ -1748,24 +1856,27 @@
     relParent := '..'.
     foundTop := false.
     [foundTop] whileFalse:[
-	topName := directoryName , '/' , relParent.
-	topName asFilename pathName = '/' ifTrue:[
-	    self warn:'could not find TOP; assume absoulte path to TOP'.
-	    topName := '/usr/local/lib/smalltalk'.
-	    foundTop := true.
-	] ifFalse:[
-	    (topName , '/configurations') asFilename exists ifTrue:[
-		(topName , '/include') asFilename exists ifTrue:[
-		    foundTop := true.
-		    topName := relParent.
-		]
-	    ].
-	    foundTop ifFalse:[
-		relParent := relParent , '/..'.
-	    ]        
-	]
+        topName := directoryName asFilename construct:relParent.
+        topName isRootDirectory ifTrue:[
+            self warn:'could not find TOP; assume absoulte path to TOP'.
+            ^ nil.
+"/            topName := '/usr/local/lib/smalltalk'.
+"/            foundTop := true.
+        ] ifFalse:[
+            ((topName construct:'stx') construct:'configurations') exists ifTrue:[
+                ((topName construct:'stx') construct:'include') exists ifTrue:[
+                    ^ relParent , '/stx'.
+                ]
+            ].
+            (topName construct:'configurations') exists ifTrue:[
+                (topName construct:'include') exists ifTrue:[
+                    ^ relParent 
+                ]
+            ].
+            relParent := relParent , '/..'
+        ]
     ].
-    ^ topName
+    ^ topName pathName
 ! !
 
 !Project methodsFor:'printing & storing'!
@@ -2460,6 +2571,6 @@
 !Project class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Project.st,v 1.98 1999-09-20 12:57:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Project.st,v 1.99 1999-09-20 14:36:21 cg Exp $'
 ! !
 Project initialize!