make is one of the Unix basic utilities for the correct execution of complex tasks. Also the operating system relies heavily on make for upgrade and administration tasks.
Complex programming should be managed using make and the compilation and
link rules defined in the description file usually named
Makefile. make uses time information to detect new files and
creates the updated version of the image using the dependecy rules specified in
the makefile. Note that there exist many different implementations of
make, such as:
/usr/bin/make #default make /usr/opt/ultrix/usr/bin/make #SYSV make /usr/bin/posix/make #enhanced XPG4/POSIX make /user/usma/bin/gmake #GNU POSIX.2 compliant makeAny make can handle simple description files, but only enhanced make implementations can handle complex descrition files, therefore check which make you are using to avoid incompatibilities.
The following simple Makefile compiles and links program ptest.f when ptest.f is newer than ptest
> cat makefile
ptest: ptest.o
f77 -o ptest ptest.o
ptest.o: ptest.f
f77 -c ptest.f
make execution can be invoked and checked by script files as shown in the
example below.
#-----------------script to run test program------------------ #!/bin/sh cd devdir #move to working directory make #make new version if update needed # # test status for errors # if test $? -ne 0 then echo; echo An error has occurred: Abort; cd .. exit else echo; echo Success; rm *.o; cd .. fi #---------------------------------------------------------