make
Alpha which includes
code for Beta and Gamma, and Beta
changes, how do I know that I need to recompile Alpha?
javac, also helps
eliminate many of those problems, as it uses import
statements to identify dependencies.
make is used to help with these problems.
make can automatically determine which files, if any, need
to be recompiled and will then recompile for you.
make for use with Java,
you will eventually encounter someone else's makefiles, and it helps
to be able to read them.
make
I think you can get by with the man pages.
make requires you to store your list of dependencies
(and related information) in a make file. This file
should be called Makefile or makefile.
thing-to-be-made : things-it-depends-upon instructions for making it
make, it looks at the thing that
you're trying to make, determines if any of the things that it
depends on have changed (or depend on things that change), and
executes the corresponding command if they have.
Game.class,
Player.class,
Sim.class, and
Rules.class and that I execute it with
java Sim, I would write
(admittedly, in this example, I'm not actually creating the filesim: Game.class Player.class Sim.class Rules.class java Sim Game.class: Game.java javac Game.java ...
sim, but that's okay)
make to recompile as necessary
and then execute with make sim
Sim.html depends on
Sim.java and that I want to rebuild all the
javadoc in order to create Sim.html, I would
write:
Sim.html: Sim.java javadoc -author -version -package *.html
-g
flag).
cc, c89, and
gcc; you probably want the same one for each
.c file you're compiling).
make provides
simple "macros" (in effect, they're variables).
NAME = value
$(NAME)
javadoc, I might define a JDOCFLAGS
macro and always use javadoc $(JDOCFLAGS) ...
make also provides some standard macros
$@ is the name of the file that was made (the target)
$? is the list of younger objects the target depends on
.c files to .o files by compiling them
with cc (or other C compiler).
.java files to .class
files by compling them with javac.
make permits you to do define such automatic conversions.
.SUFFIXES : .java .class .html .o .c
$* is the common prefix of target and related file
$< is the name of the file that "caused" the action
.java
to .class, I might have
.SUFFIXES : .java .class JC = "javac" JCFLAGS = "" .java.class: $(JC) $(JCFLAGS) $<
make all should make all the primary components of
your system (many systems provide a number of programs, this makes
all the core ones).
make should do the same thing as make all
(make by itself does the first rule in your file)
make print should print the key files in the library
(or even the recently changed libraries)
make clean should clean up any object files you have
laying around
make install should install everything in the appropriate
place (e.g., if someone were moving your software to a new machine)
make archive should make an archive of your source code
(and Makefile) suitable for transportation elsewhere.
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
Source text last modified Mon Nov 10 08:57:27 1997.
This page generated on Mon Nov 10 10:13:13 1997 by SiteWeaver.
Contact our webmaster at rebelsky@math.grin.edu