SAS/C Utilities

Beyond the compiler (sc), linker (slink), and debugger (cdbg), the SAS/C Development System v6.58 ships a suite of utilities for building, maintaining, and inspecting code. Source: Vol 2 Ch.10 (Utility Reference, pp. 207–306).

smake — build coordinator

smake is the SAS/C equivalent of make. It reads an smakefile (or makefile if s is not found), computes dependencies, and re-invokes sc/slink for any out-of-date targets.

smake                        # build using smakefile in current dir
smake -f myproject.mk        # use a custom file
smake target                 # build a specific target
smake -n                     # dry run, print commands without executing
smake -d                     # debug output (very verbose)

smakefile syntax

CC = sc
CFLAGS = optimize=2 structureequivalence debug=line

all: myapp

myapp: myapp.c utils.o
    $(CC) link $(CFLAGS) myapp.c utils.o

utils.o: utils.c utils.h
    $(CC) $(CFLAGS) utils.c

clean:
    delete myapp utils.o

smake understands standard make syntax plus AmigaOS-specific extensions. Automatic variables work as in GNU make: $@ (target), $< (first dependency), $^ (all dependencies), $* (stem of pattern rule).

Special targets

Target Effect
.PHONY Mark a target as not producing a file with the same name
.PRECIOUS Don't delete intermediate files on error
.SILENT Suppress command echo
.IGNORE Ignore command errors

Gotchas

  • smake uses tabs for command lines, not spaces. If you copy a Makefile from a Linux project, convert indentation.
  • The delete command is the AmigaOS equivalent of rm. smake will use it for cleanup rules.
  • File timestamps come from the filesystem, which on the Amiga has a 1-second resolution (FSTime()). make may rebuild a target unnecessarily if two files were created within the same second.

sLink (capital L; command name slink) is the SAS/C linker, distinct from Amiga's slink (no caps) which is a different tool.

slink FROM lib:c.o prog.o utils.o lib:sc.lib lib:amiga.lib TO prog
slink FROM c.o prog.o lib:sc.lib TO prog ND                  # no debug
slink FROM c.o prog.o lib:sc.lib TO prog ADDSYM             # add sym table

Library search order

sLink searches libraries in the order given, pulling in any object module that satisfies an unresolved symbol. Once a library is opened, later modules in that library are not scanned unless another unresolved symbol appears.

A common pattern:

slink FROM c.o prog.o utils.o lib:sc.lib lib:amiga.lib TO prog

Here sc.lib (the SAS/C runtime) is searched first because it provides common runtime helpers; amiga.lib (the NDK stub library) is searched next.

Library file formats

sLink reads both:

  • OMF-style libraries: sc.lib, amiga.lib — built with oml.
  • Hunk-format libraries: produced by slink lib from a list of object files.

Mixing them in the same link line is allowed but order matters: the linker scans each library completely and resolves all possible references before moving on.

oml — object module librarian

oml builds and maintains libraries in OMF (relocatable) format. sc.lib and amiga.lib are in this format.

oml -r lib:sc.lib + c.o stdio.o string.o      # add modules (replace if present)
oml lib:sc.lib - c.o                            # remove c.o
oml lib:sc.lib -L                              # list contents
oml lib:sc.lib -X                              # extract all

oml is to sc.lib what ar is to a Unix .a file.

bum — BSD UNIX maintainer

bum is the SAS/C equivalent of ar/ranlib for hunk-format libraries (LVO-style AmigaOS libraries).

bum lib:my.lib + my.o        # add
bum lib:my.lib - my.o        # remove
bum lib:my.lib                # list
bum lib:my.lib -r             # rebuild index

Use bum for libraries that will be opened with OpenLibrary() (i.e., shared libraries, not static link libs).

blazemgr — compiler accelerator

blazemgr keeps the SAS/C compiler in memory between invocations, eliminating the seconds-long startup of the cross-compilation tools. It is the AmigaOS equivalent of ccache on Linux.

blazemgr                     # run as a background daemon
sc foo.c                     # compiles faster; blazemgr intercepts
blazemgr -kill               # shut down

The daemon keeps a parsed copy of compiler state in RAM, so subsequent invocations skip the load-and-parse phase. On a 7 MHz Amiga 500, the gain is significant; on a 68030/50, it's still measurable for large compiles.

blazemgr is configured by S:blazemgr.config (if present) and respects the BLAZEMGR_PORT environment variable for the IPC port name.

mkmk — Makefile generator

mkmk generates an smakefile from a list of source files. It guesses dependencies based on #include directives.

mkmk myproject                # creates smakefile in current dir
mkmk -o makefile myproject    # alternative output name

Generated smakefile is a starting point — review before committing.

fpsp — floating-point support package

fpsp is the floating-point emulator for 68000/68010 systems without an FPU. It provides IEEE-format arithmetic in software.

fpsp                         # load as a library or device
sc math=ffp myprog.c         # use FFP (fast) instead of IEEE
sc math=ieee myprog.c        # use IEEE with fpsp

For new code, prefer math=ieee for portability and to match <math.h> semantics. math=ffp is faster but uses the legacy Amiga FFP format and does not match IEEE.

cdbg / cdbg-stub — debugger (covered in Debugger — CodeProbe)

The debugger is documented separately. The cdbg-stub is the small target-side program that enables cross-debugging (see Debugger — Advanced).

resdent — resident command compiler

resdent builds resident commands — commands that are pre-loaded into RAM and run without disk access. Resident commands are how Workbench's C: assign worked in early AmigaOS.

resdent mycmd                # produces a resident command in current dir
resdent -o ram:mycmd mycmd    # place directly in RAM:

A modern AmigaOS doesn't need resident commands the way 1.x did, but resdent is still useful for time-critical tools.

Commodore — command-line starter

Commodore is the SAS/C Shell environment bundled with the compiler. It is a TCsh-style command interpreter with history, completion, and aliases.

Commodore                    # start interactive Commodore
Commodore -c "sc foo.c"      # run a single command and exit

Many of the NDK example projects are designed to be built under Commodore, not the stock AmigaOS Shell.

tr — transliterator

tr does character-by-character translation:

tr a-z A-Z < input > output  # uppercase conversion
tr -d '\r' < dos.txt > unix.txt  # strip CRs

Useful for cleaning up text files transferred from foreign systems.

See Also


Sources: SAS Institute Inc., "SAS/C Development System User's Guide, Volume 2" Ch.10, Version 6.50 (1993), pp. 207–306. Raw: raw/sasc/sasc-utilities-extract.md Updated: 2026-10-02