Project.st
changeset 4822 5f37058e56c8
parent 4821 c73b170cb6e0
child 4823 7308f4a53be6
--- a/Project.st	Sun Sep 26 16:19:27 1999 +0200
+++ b/Project.st	Mon Sep 27 00:03:29 1999 +0200
@@ -1588,6 +1588,367 @@
     "Modified: / 26.9.1999 / 16:18:29 / cg"
 !
 
+createNTMakefile
+    "creates an nt.mak file"
+
+    |d f s type appName libName startUpClass startUpSelector
+     topName classes numBad firstBad msg methodsFile|
+
+    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 ''nt.mak''-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.
+    ].
+
+    "/ to not list private classes
+    classes := classes select:[:cls | cls owningClass isNil].
+    classes := classes copy topologicalSort:[:a :b | b isSubclassOf:a].
+
+    topName := self findTopFrom:directoryName.
+
+
+    Transcript showCR:'creating bmake.bat'.
+    d := directoryName asFilename.
+    f := d construct:'bmake.bat'.
+    s := f writeStream.
+    s isNil ifTrue:[
+        self warn:'cannot create bmake.bat'.
+        ^ self
+    ].
+    s nextPutLine:'mkdir objbc'. 
+    s nextPutLine:'make.exe -N -f nt.mak %1 %'. 
+    s close.
+
+    Transcript showCR:'creating bc.def'.
+    d := directoryName asFilename.
+    f := d construct:'bc.def'.
+    s := f writeStream.
+    s isNil ifTrue:[
+        self warn:'cannot create bc.def'.
+        ^ self
+    ].
+    s nextPutLine:'LIBRARY         ' , self libraryName.
+    s nextPutLine:'DESCRIPTION     ''AddOn library for ST/X''
+CODE            PRELOAD MOVEABLE DISCARDABLE
+SEGMENTS
+    INITCODE PRELOAD SHARED DISCARDABLE
+EXPORTS
+    __' , self libraryName , '_Init     @1'.
+    s close.
+
+    Transcript showCR:'creating nt.def'.
+    d := directoryName asFilename.
+    f := d construct:'nt.def'.
+    s := f writeStream.
+    s isNil ifTrue:[
+        self warn:'cannot create nt.def'.
+        ^ self
+    ].
+    s nextPutLine:'LIBRARY         ' , self libraryName.
+    s nextPutLine:'DESCRIPTION     ''AddOn library for ST/X''
+CODE            EXECUTE READ SHARED
+DATA            READ WRITE
+SECTIONS
+    INITCODE READ EXECUTE SHARED
+    INITDATA READ WRITE
+EXPORTS
+    _' , self libraryName , '_Init'.
+    s close.
+
+    Transcript showCR:'creating nt.mak'.
+
+    d := directoryName asFilename.
+    f := d construct:'nt.mak'.
+    f exists ifTrue:[
+        f renameTo:(d construct:'nt.mak.bak')
+    ].
+    s := f writeStream.
+    s isNil ifTrue:[
+        self warn:'cannot create nt.mak'.
+        ^ self
+    ].
+    s nextPutAll:'# $' , 'Header'. 
+    s nextPutLine:'$'.
+    s nextPutAll:'#
+# -- nt.mak created from project at ' . 
+    s nextPutAll:Smalltalk timeStamp. 
+    s nextPutAll:'
+#
+# Warning: YOU SHOULD NOT MODIFY THIS FILE - MODIFY THE .prj FILE INSTEAD
+# and let the ProjectBrowser recreate this file.
+# once you modify this file, do not recreate nt.mak 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)
+
+#
+# position (of this package) in directory hierarchy:
+# (must point to ST/X top directory, for tools and includes)
+TOP=' , topName ,'
+
+!!INCLUDE "$(TOP)\rules\stdHdrNT"
+
+# subdirectories where targets are to be made:
+SUBDIRS=
+
+# 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 libraryName , '
+
+
+# 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
+#
+# ********** 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
+#
+# ********** OPTIONAL: MODIFY the next line(s) ***
+# STCWARNINGS=-warn
+# STCWARNINGS=-warnNonStandard
+# STCWARNINGS=-warnEOLComments
+STCWARNINGS='.
+        (self propertyAt:#'make.stc.warnEOLComments') == false ifTrue:[
+            s nextPutAll:'-warnEOLComments '.
+        ].
+        (self propertyAt:#'make.stc.warnNonStandard') == false ifTrue:[
+            s nextPutAll:'-warnNonStandard '.
+        ].
+        s nextPutAll:((self propertyAt:#'make.stc.WARNINGOPTIONS') ? '') , '
+
+# if your embedded C code requires any system includes, 
+# add the path(es) here:, 
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALINCLUDES=-Ifoo -Ibar
+LOCALINCLUDES=' , ((self propertyAt:#'make.stc.LOCALINCLUDES') ? '') , '
+
+# if you need any additional defines for embedded C code, 
+# add them here:, 
+# ********** OPTIONAL: MODIFY the next lines ***
+# LOCALDEFINES=-Dfoo -Dbar -DDEBUG
+LOCALDEFINES=' , ((self propertyAt:#'make.stc.LOCALDEFINES') ? '') , '
+
+STCLOCALOPT=-I. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALINCLUDES) $(LOCALDEFINES) -H. ''-P$(PACKAGE)'' ''-varPrefix=$(LIBNAME)'' $(COMMONSYMFLAG) $(INITCODESEPFLAG)
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C-libraries that should be pre-linked with the class-objects
+LD_OBJ_LIBS=' , ((self propertyAt:#'make.LD_OBJ_LIBS') ? '') , '
+
+# ********** OPTIONAL: MODIFY the next line ***
+# additional C targets or libraries should be added below
+LOCAL_EXTRA_TARGETS=' , ((self propertyAt:#'make.LOCAL_EXTRA_TARGETS') ? '') , '
+
+#ALL:: preMake $(LIBDIR)\$(LIBNAME).lib $(BINDIR)\$(LIBNAME).dll postMake
+ALL:: $(LIBDIR)\$(LIBNAME).lib $(BINDIR)\$(LIBNAME).dll
+
+
+'.
+
+"/    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 clsInfo cond include|
+
+        clsInfo := self classInfoFor:aClass.
+        include := true.
+        clsInfo notNil ifTrue:[
+            cond := clsInfo conditionForInclusion.
+            (self conditionForInclusionIsTrue:cond) ifFalse:[
+                include := false.
+            ] ifTrue:[
+                (self conditionForAutoloadIsTrue:cond) ifTrue:[
+                    include := false
+                ]
+            ].
+        ].
+        include ifTrue:[
+            s nextPutAll:' \'. s cr.
+            abbrev := Smalltalk fileNameForClass:aClass name.
+            s nextPutAll:'  $(OUTDIR)'; nextPutAll:abbrev; nextPutAll:'.$(O)'.
+        ]
+    ].
+    (methodsFile := self propertyAt:#methodsFile) size > 0 ifTrue:[
+         s nextPutAll:' \'. s cr.
+         s nextPutAll:'  $(OUTDIR)'; 
+           nextPutAll:(methodsFile asFilename withoutSuffix baseName);
+           nextPutAll:'.$(O)'.
+    ].
+    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
+
+#clean::
+#' , Character tab , '-del $(OUTDIR)*.obj
+#' , Character tab , '-del *.sc
+
+#clobber::
+#' , Character tab , '-del $(OUTDIR)*.obj
+#' , Character tab , '-del *.sc
+#' , Character tab , '-del *.dll
+#' , Character tab , '-del *.lib
+
+
+!!INCLUDE $(TOP)\rules\stdRulNT
+
+# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
+'.
+    classes notNil ifTrue:[
+        classes do:[:aClass |
+            |abbrev|
+
+            abbrev := Smalltalk fileNameForClass:aClass name.
+            s nextPutAll:'$(OUTDIR)'; 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:[
+        s nextPutAll:'ALL:: $(PROGS)'; cr.
+
+        s nextPutAll:appName.
+        s nextPutAll:':: main.$(O) classList.$(O) $(OBJS)'; cr.
+        s tab;      nextPutAll:'$(LD) $(ST_LDFLAG) $(LDFLAGS) -o ';
+                    nextPutAll:appName;
+                    nextPutAll:' \'; cr.
+        s tab; tab; nextPutAll:'$(CRT0) main.$(O) classList.$(O) $(OBJS) $(EXTRA_OBJ) $(LIBOBJS) \'; cr.
+        s tab; tab; nextPutAll:'$(LIBRUNDIR)/hidata.o $(LIBRUN) \'; cr.
+        s tab; tab; nextPutAll:'$(MATHLIB) $(EXTRALIBS) -lXext $(SYSLIBS) $(OTHERLIBS) $(CRTN)'; cr.
+    ].
+
+    s close
+
+    "Modified: / 27.9.1999 / 00:02:45 / cg"
+!
+
 createProjectFiles
     "actually, creates all files to do a make in the project directory"
 
@@ -2782,6 +3143,6 @@
 !Project class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Project.st,v 1.114 1999-09-26 14:19:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Project.st,v 1.115 1999-09-26 22:03:29 cg Exp $'
 ! !
 Project initialize!