--- a/Project.st Wed Oct 06 14:10:22 1999 +0200
+++ b/Project.st Wed Oct 06 14:32:32 1999 +0200
@@ -1395,6 +1395,46 @@
OperatingSystem executeCommand:('cd ' , self directory , ' ; make')
!
+buildProjectWithOutputTo:aStream
+ "invoke 'make' in the project directory"
+
+ |p cmdOutStream cmdInStream readerProcess|
+
+ aStream notNil ifTrue:[
+ "/ need an external stream for that.
+ aStream isExternalStream ifTrue:[
+ cmdOutStream := aStream
+ ] ifFalse:[
+ p := ExternalStream makePipe.
+ cmdOutStream := p at:2.
+ "/ start a reader process
+ readerProcess := [
+ |data|
+
+ cmdInStream := p at:1.
+ [cmdInStream atEnd] whileFalse:[
+ data := cmdInStream nextAvailable:512.
+ aStream nextPutAll:data.
+ ]
+ ] newProcess.
+ readerProcess name:'cmd output reader'.
+ readerProcess resume.
+ ]
+ ].
+
+ OperatingSystem
+ executeCommand:('cd ' , self directory , ' ; make')
+ inputFrom:nil
+ outputTo:cmdOutStream
+ errorTo:cmdOutStream
+ inDirectory:nil
+ onError:[:status| false].
+
+ readerProcess terminate.
+ cmdInStream close.
+ cmdOutStream close.
+!
+
classesInOrderFor:whatMsg
|classes numBad firstBad msg|
@@ -1445,12 +1485,13 @@
in the projects source directory."
|d f out in topName classes classInfo
- methodsFile prerequisitePackages|
+ methodsFile prerequisitePackages transcript|
classes := self classesInOrderFor:'generate ''loadAll''-file.'.
classes isNil ifTrue:[^ self].
- Transcript showCR:'creating loadAll file'.
+ transcript := Transcript current.
+ transcript showCR:'creating loadAll file'.
d := directoryName asFilename.
f := d construct:'loadAll'.
@@ -1574,55 +1615,57 @@
out close
!
+createMacMakefile
+ "creates an mac-os makefile"
+
+ Transcript current showCR:'Mac support not yet implemented - no mac.mak created for Mac'.
+!
+
createMakefile
"creates an initial Makefile from a Make.proto file.
Requires the stmkmf script"
- |d top|
+ |d top transcript|
OperatingSystem isUNIXlike ifTrue:[
- Transcript showCR:'creating Makefile'.
+ Transcript current showCR:'creating Makefile'.
d := directoryName asFilename pathName.
top := (d , '/' , (self findTopFrom:directoryName)) asFilename pathName.
+ transcript := Transcript current.
+
(OperatingSystem
executeCommand:('sh ' , top , '/rules/stmkmf')
- inDirectory:d) ifFalse:[
+ outputTo:transcript
+ errorTo:transcript
+ inDirectory:d
+ ) ifFalse:[
self warn:'Could not execute stmkmf - no Makefile built.'
].
- ] ifFalse:[
- OperatingSystem isMSWINDOWSlike ifTrue:[
- self createNTMakefile
- ] ifFalse:[
- OperatingSystem isVMSlike ifTrue:[
- self createVMSMakefile
- ] ifFalse:[
- OperatingSystem isMAClike ifTrue:[
- self createMacMakefile
- ] ifFalse:[
- self warn:'Cannot create Makefile'
- ]
- ]
- ]
].
+ self createNTMakefile.
+ self createVMSMakefile.
+ self createMacMakefile.
"Modified: / 26.9.1999 / 16:18:29 / cg"
!
createNTMakefile
- "creates an nt.mak file"
+ "creates an nt.mak makefile"
|d f s type appName libName startUpClass startUpSelector
- topName classes methodsFile|
+ topName classes methodsFile transcript|
classes := self classesInOrderFor:'generate ''nt.mak''-file.'.
classes isNil ifTrue:[^ self].
topName := self findTopFrom:directoryName.
-
- Transcript showCR:'creating bmake.bat'.
+ transcript := Transcript current.
+ transcript showCR:'Generating make support for Win9x/WinNT...'.
+ transcript showCR:'creating bmake.bat'.
+
d := directoryName asFilename.
f := d construct:'bmake.bat'.
s := f writeStream.
@@ -1635,7 +1678,8 @@
s close.
- Transcript showCR:'creating bc.def'.
+ transcript showCR:'creating bc.def'.
+
d := directoryName asFilename.
f := d construct:'bc.def'.
s := f writeStream.
@@ -1653,7 +1697,8 @@
s close.
- Transcript showCR:'creating nt.def'.
+ transcript showCR:'creating nt.def'.
+
d := directoryName asFilename.
f := d construct:'nt.def'.
s := f writeStream.
@@ -1673,7 +1718,8 @@
s close.
- Transcript showCR:'creating libInit.cc'.
+ transcript showCR:'creating libInit.cc'.
+
d := directoryName asFilename.
f := d construct:'libInit.cc'.
s := f writeStream.
@@ -1718,8 +1764,7 @@
'.
s close.
-
- Transcript showCR:'creating nt.mak'.
+ transcript showCR:'creating nt.mak'.
d := directoryName asFilename.
f := d construct:'nt.mak'.
@@ -2023,7 +2068,7 @@
topName := self findTopFrom:directoryName.
- Transcript showCR:'creating Make.proto'.
+ Transcript current showCR:'creating Make.proto'.
d := directoryName asFilename.
f := d construct:'Make.proto'.
@@ -2309,68 +2354,75 @@
|classes methods methodClasses dir stream|
dir := self directory asFilename.
- Transcript showCR:'creating sources in ' , dir pathName , ' ...'; endEntry.
+ Transcript current showCR:'creating sources in ' , dir pathName , ' ...'; endEntry.
classes := self classes.
classes isNil ifTrue:[
- self warn:'no classes in current project'
+ self warn:'no classes in current project'
].
classes notNil ifTrue:[
- classes do:[:aClass |
- aClass isLoaded ifFalse:[
- aClass autoload.
- ].
- ].
- "/ to not list private classes
- classes := classes select:[:cls | cls owningClass isNil].
- classes := classes topologicalSort:[:a :b | a isSubclassOf:b].
-
- classes do:[:aClass |
- Transcript show:' ... '; showCR:aClass name, '.st'; endEntry.
- aClass fileOutIn:dir
- ]
+ classes do:[:aClass |
+ aClass isLoaded ifFalse:[
+ aClass autoload.
+ ].
+ ].
+ "/ to not list private classes
+ classes := classes select:[:cls | cls owningClass isNil].
+ classes := classes topologicalSort:[:a :b | a isSubclassOf:b].
+
+ classes do:[:aClass |
+ Transcript current show:' ... '; showCR:aClass name, '.st'; endEntry.
+ aClass fileOutIn:dir
+ ]
].
methods := self individualMethods.
methods notNil ifTrue:[
- methods := methods asIdentitySet.
- "
- get classes ...
- "
- methodClasses := IdentitySet new.
- methods do:[:m |
- |mCls|
-
- mCls := m containingClass.
- mCls isMeta ifTrue:[
- mCls := mCls soleInstance.
- ].
- methodClasses add:mCls].
- "
- fileOut by class
- "
- methodClasses do:[:cls |
- stream := (self directory asFilename construct:(cls name , '.chg')) writeStream.
-
- Transcript show:' ... '; showCR:cls name, '.chg'; endEntry.
- methods do:[:m |
- |mCls|
-
- mCls := m containingClass.
- (mCls == cls or:[mCls == cls class]) ifTrue:[
- mCls fileOutMethod:m on:stream.
- ].
- stream cr.
- ].
- stream close.
- ].
+ methods := methods asIdentitySet.
+ "
+ get classes ...
+ "
+ methodClasses := IdentitySet new.
+ methods do:[:m |
+ |mCls|
+
+ mCls := m containingClass.
+ mCls isMeta ifTrue:[
+ mCls := mCls soleInstance.
+ ].
+ methodClasses add:mCls].
+ "
+ fileOut by class
+ "
+ methodClasses do:[:cls |
+ stream := (self directory asFilename construct:(cls name , '.chg')) writeStream.
+
+ Transcript current show:' ... '; showCR:cls name, '.chg'; endEntry.
+ methods do:[:m |
+ |mCls|
+
+ mCls := m containingClass.
+ (mCls == cls or:[mCls == cls class]) ifTrue:[
+ mCls fileOutMethod:m on:stream.
+ ].
+ stream cr.
+ ].
+ stream close.
+ ].
].
"Modified: 1.11.1996 / 16:37:15 / cg"
"Modified: 18.9.1997 / 18:50:34 / stefan"
!
+createVMSMakefile
+ "creates an vms.mak makefile"
+
+ Transcript current showCR:'VMS support not yet implemented - no vms.mak created'.
+
+!
+
findTopFrom:directoryName
"returns the relative path from directoryName to the TOP
directory."
@@ -3173,6 +3225,6 @@
!Project class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Project.st,v 1.120 1999-10-03 16:55:37 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Project.st,v 1.121 1999-10-06 12:32:32 cg Exp $'
! !
Project initialize!