CFILES = $("*.c" G) # glob up all the C sources
OFILES = $((CFILES P)).o # enumerate the CFILES, strip the .c,
# add a .o
it: $(OFILES)
cc -o $@ $(OFILES)
%.o: %.c
cc -c $?
Myke also allows you to put these rules in a configuration file,
thus saving enumerating them in every Mykefile.
Taken to an extreme you can omit the Mykefiles altogether.
Here is my .mykerc file as an example.
Here is the manual entry: web page, source form.
Licence: you can do what you like with this, but if you give it to someone else make sure they know I wrote it, and if you modify it make sure the mods are clearly marked as yours. If you make fixes or improvements, I'd appreciate patches and descriptions sent to me for incorporation in my central source. Naturally you'll be credited with such changes.
The source for myke comes in three parts:
mkdir myketmp
cd myketmp
gunzip <myke.tar.gz | tar xvf -
gunzip <libcs.tar.gz | tar xvf -
mkdir include
( cd include
gunzip <../csincs.tar.gz | tar xvf -
)
mkdir bin
( cd bin
gunzip <tools.tar.gz | tar xvf -
)
systemid.vendor.cpu.osAn ls of the site subdirectory will show you typical names used so far.
The systemid is some useful name for the group of
machines for which you'll be compiling myke.
For example, while at OTC doing some of the early work
on myke I used the name "otc" for the systemid there.
A local domain name is also often good.
The vendor is the general name for the machines
to run this binary.
The cpu is the general class of CPU used.
For example, m68k denotes the whole Motorola M680x0
series of CPUs.
Hopefully you'll find your CPU listed already.
The os is the general type of operating system
you're running and is typically a vendor-specific name.
For example,
most Silicon Graphics machines run IRIX,
and the name irix is used.
If not,
you'll probably want to make new _vend_*
and possibly _cpu_* clauses.
On most modern machines the best approach it to claim to
have a POSIX-compliant ANSI-C machine and to add exceptions
as needed if libcs fails to build.
Thus _vend_vendor_osname
You may later have to add some extra options if you
run into compile problems.
Contact me if things start getting weird.
: STDC
: POSIX
M vendor vendor
M system osname
Set the environment vaiable ARCH
to the vendor.cpu.os string chosen above.
cd include/cs/config
You will need to repeat this step
whenever you amend the config file.
perl config.pl
cccs -c a2gid.cIf this fails, amend the config file you edited earlier, rerun config.pl, and try it again.
If you're using gcc (cccs does by default), expect to have to ignore warnings about:
cccs -c *.c 2>cc.err && ar cv libcs.a *.oIf you run into problems, amend the configuration and try again. On some platforms you may need to run ranlib on the final library.
cccs -c *.c 2>cc.err && ar rsv libcs.a *.o
cccs -c -DGLOBALMYKERC=/usr/local/etc/mykerc *.c
cc -o myke *.o ../libcs/libcs.a
myke