[net.micro.amiga] C devel. environment

jimm@amiga.UUCP (Jim Mackraz) (01/01/86)

    My native AMIGA development environment(s).

    I develop AMIGA code on a Sun with Greenhills, and an Amiga
    with either 512K or 1M bytes of RAM:.  Below is my contribution
    to setting up a native development environment that:

    1) Provides me with disk space for my source code
    2) Is relatively fast, by making use of the RAM: device
    3) Is not difficult to re-establish in the event of a new
	CLI or compiler/libraries/includes release 
    4) Is convenient to set up when first booting or after crashes

    I will describe both native environments I use.  I will first describe
    the diskettes, then the logical devices, then will present the sequence
    files (shell scripts) I run to set up things and exactly what I do.

    I welcome any observations which would make my life easier.  I will
    post any improvements which I am mailed that seem important.

    Environment 1 (512KB of RAM):

    Disks:
	CLI -- workbench disk without the workbench.  Previous postings
	describe what to throw away.  The c: directory on this disk is 
	quite full, including format, ED (or emacs) but no EDIT, various
	development tools (wack, snoop, drip, atom, stripa, and other
	stuff i don't use).  This disk is used for boot, l:ram-handler,
	and commands.  Design goal (3) dictates that I don't spend a lot of
	time messing with this disk.

	I do, however, rename some frequently used commands, in particular, 
	"execute" has become "x".  This is used frequently below.

	INCLUDE3.03 -- current include files.  These I copied off of the
	development disk into INCLUDE3.03:include.  (Some of) these files
	are copied to RAM:include.  This disk can then be removed and set
	aside.  In the root, INCLUDE3.03:, there is a sequence file 
	named copy-includes which copies to RAM:include the includes I need
	for normal work.  Abnormal work would lead me to create a family
	of copy-includes'.  See this file below.

	By the way, new development disks will have comments stripped out of
	the include files for at least three reasons: to fit them on the disk,
	and to take up less room in ram:, and to take less time to parse
	at compile time.  I would prefer a set of each -- comments and
	no-comments -- which I would keep on INCLUDE3.03; the former for
	reference (until 1.1 manuals arrive), the latter for compiling.

	C-DEVEL -- my C development disk.  The includes are deleted, first
	being copied to INCLUDE3.03.  I don't know what came in the :c
	directory, but everything but LC1, LC2, alink, and assem are gone,
	either copied to CLI:c or thrown away.  I threw LC away.

	There is a directory C-DEVEL:src which contains project subdirectories,
	in which I work.  An example is C-DEVEL:src/go, in which I keep
	source for a go-board/movie program I am playing with.

	The sequence directory C-DEVEL:s contains all of the shell scripts I
	will describe below.  I also tossed most of what I found in this
	directory.

    Logical Devices:
	After everything is set up, I have the made the following assignments,
	or left them at their initial defaults.

	SYS:	CLI
	C:  	SYS:c
	DEV:	C-DEVEL:	; name of development disk
	lc:	DEV:C		; where lattice passes are gotten
	s:	DEV:s		; sequence files found here
	link:	DEV:c		; where alink is found
	lib:	DEV:lib		; home of .lib files and startup stuff
	include: RAM:include	; include files
	go:	DEV:src/Go	; my go board/movie program work directory

    Sequence Files and Procedure:

	After boot, I insert INCLUDE3.03: in df1: and execute:
	    x df1:copy-includes	; notice that I renamed execute
	This builds a RAM:include directory.

	Then I replace INCLUDE3.03 in df1: with C-DEVEL and execute:
	    x df1:s/setup

	I am then ready to go.

	I compile a single source file go.c by typing:
	    x cc go
	and link using:
	    x ld go	; in fact "x ld" works, by default.  See ld.

	The file s:ld just alink's with go.with, which is in go:.

    Here are the files.  comments marked NOTE are added now:
	::::::::::::::
	copy-includes
	::::::::::::::
	; copy include files from disk to  ram:
	; name of this disk is INCLUDE3.03
	assign include: INCLUDE3.03:include
	failat 100	; NOTE this is overkill
	makedir ram:include
	makedir ram:include/exec
	makedir ram:include/intuition
	makedir ram:include/graphics
	makedir ram:include/devices
	copy include:intuition/ to ram:include/intuition all quiet
	copy include:exec to  ram:include/exec all quiet
	copy include:graphics/gfx.h to ram:include/graphics
	copy include:graphics/clip.h to ram:include/graphics
	copy include:graphics/view.h to ram:include/graphics
	copy include:graphics/rastport.h to ram:include/graphics
	copy include:graphics/layers.h to ram:include/graphics
	copy include:graphics/text.h to ram:include/graphics
	copy include:devices/timer.h to ram:include/devices
	copy include:devices/inputevent.h to ram:include/devices
	assign include: ram:include

	::::::::::::::
	setup
	::::::::::::::
	.key DEV/k
	assign DEV: <DEV$C-DEVEL:>
	assign lc: DEV:C
	assign s: DEV:s
	assign link: DEV:c
	assign lib: DEV:lib

	assign go: DEV:src/Go

	::::::::::::::
	cc
	::::::::::::::
	.Key file,opt1,opt2,opt3
	if not exists <file$t1>.c
	   echo "File <file$t1>.c does not exist.  Try again."
	   skip END
	   endif

	LC:lc1  -cw -iINCLUDE: -iINCLUDE:lattice -oRAM: <file>.c
	; NOTE this makes SURE that file.q is on RAM:

	if not exists ram:<file>.q
	   echo "First pass failed"
	   skip END
	   endif

	LC:lc2  -o<file>.obj ram:<file>.q
	lab END

	::::::::::::::
	ld
	::::::::::::::
	.key file
	link:alink with <file$go>.with

	::::::::::::::
	go.with
	::::::::::::::
	FROM *
	LIB:Lstartup.obj,*
	go.obj,*
	go2.obj,*
	godata.obj,*
	goinit.obj,*
	gomv.obj,*
	gogadg.obj,*
	godebug.obj
	LIBRARY *
	lib:lc.lib,*
	lib:amiga.lib,*
	lib:debug.lib
	TO go


    Environment 2 (1MB RAM):

    Summary:
	Frequently used commands, all scanned libraries, all includes 
	used, both passes of the compiler and the linker are all in RAM:
	This makes for fast compiles, but slow reloading after a crash.
	Only source and .obj and executable reside on disk.  It so happens
	that my source is on my DEV disk, but that is so I can work on
	a 512KB machine.  This setup would allow source-only disks to 
	be used in either DF0: or DF1:, with a backup disk in the other
	drive.

    Disks:
	Same as above, with one exception.  I will be putting frequently
	used commands into RAM:c.  To satisfy design goal (3), I do this
	by copying CLI:c to RAM:c (all quiet) and then removing the disk
	hogs that I don't use often.   It is faster, however, not to copy
	them at all, so I made a directory CLI:j and moved (rename) the
	commands I don't like to copy to RAM: into CLI:j.  Those commands
	moved are a subset of those deleted from RAM:c by s:cram, below.

    Logical Devices:

	SYS:	CLI:		; normally removed from DF0:
	DEV:	C-DEVEL:	; name of development disk
	C:  	RAM:c		; a subset of commands
	lc:	RAM:LC		; where lattice passes are gotten
	s:	RAM:s		; sequence files searched here
	link:	RAM:LC		; where alink is found
	lib:	RAM:lib		; home of .lib files and startup stuff
	include: RAM:include	; include files
	go:	DEV:src/Go	; my go board/movie program work directory

	NOTE: the freedom to remove CLI: from the drive promotes making
	backups, I found, since I leave a backup disk in DF0:.  I put CLI
	back into DF0: if I need to use a command which is not in
	RAM:c (e.g. atom).

    Sequence Files and Procedure:

	Setup is different, but compile and link is the same, only
	much, much faster.

	Setup: after boot, put C-DEVEL: in DF1: and type
	    x df1:s/bigsetup.

	For more setup speed, keep the secret sequence temp file in RAM:
	    cd ram:
	    makedir t
	    x df1:s/bigsetup

	Notice that bigsetup has arguments which prevent parts of the big
	operation from being done.  Also, my addmem is done here, instead of
	in my startup-sequence, which is probably not what the typical 
	memory-add-on owner will do.

	::::::::::::::
	bigsetup
	::::::::::::::
	. bigsetup -- set up from boot, including addmem
	. arguments: c-omit commands, lc-omit lattice, lib-omitlibs
	.     mem-omit addmem, inc-omit includes, stop-abort
	.key c/s,lc/s,lib/s,mem/s,inc/s,stop/s

	; NOTE: "stop" allows you to abort if you type "x bigstep ?"
	if not <stop$""> eq ""
	   echo "aborting execution"
	   quit 0
	endif

	cd c-devel:
	if <mem$""> eq ""
	   echo "addmem"
	   addmem f00000 f7fffe
	endif
	; NOTE: this is only valid for a RAM cartridge like mine.
	;	you find your own extensions RAM address

	; NOTE: trying to speed up subsequent EXECUTE scripts
	if not exists ram:t
	   makedir ram:t
	endif
	cd ram:

	echo "execute setup"
	x c-devel:s/setup

	echo "sequences to ram:"
	x sram

	if <c$""> eq ""
	   echo "commands to ram:"
	   x cram
	endif

	if <lc$""> eq ""
	   echo "lattice to ram:"
	   x lcram
	endif

	if <lib$""> eq ""
	   echo "libraries to ram:"
	   x libram
	endif

	; NOTE: this next will call for the includes disk which is typically
	; not present at this point
	if <inc$""> eq ""
	   echo "now includes"
	   x INCLUDE3.03:copy-includes
	endif

	::::::::::::::
	sram
	::::::::::::::
	; set up script files in ram: disk
	if not exists ram:s
	   makedir ram:s
	endif

	copy s: to ram:s all quiet
	assign s: ram:s

	::::::::::::::
	cram
	::::::::::::::
	; cram -- put commands on ram:, delete not-often-used-and-big

	if not exists ram:c
	   makedir ram:c
	endif

	copy c: to ram:c all
	echo "commands copied"
	assign c: ram:c

	failat 100
	cd c:
	echo "delete many commands"
	delete assem setserial debug absload wack stripa sort
	delete say upload disked dumpobj addmem sendxon setparallel
	delete atom colorp snoop freemap t ms loadwb romwack
	delete wait dl which drip frags join fault reboot
	delete prompt install relabel
	cd ram:

	::::::::::::::
	lcram
	::::::::::::::
	; set up lattice passes in ram: disk
	if not exists ram:LC
	   makedir ram:LC
	endif

	copy LC:LC1 ram:LC/LC1
	copy LC:LC2 ram:LC/LC2
	copy LINK:alink ram:LC/alink
	assign LC: ram:LC
	assign LINK: ram:LC

	::::::::::::::
	libram
	::::::::::::::
	; copy libs onto ram:
	if not exists ram:lib
	   makedir ram:lib
	endif

	copy lib: to ram:lib all quiet
	assign lib: ram:lib
	delete lib:Astartup.obj		; I never use


	----
    Happy hacking:	jimm