110 likes | 240 Views
makefile. M.A Doman. What is the make utility?. make is a standard linux command to automatically determine when parts of a large project require recompilation Governed by a set of rules built in a makefile # indicates comment line target: prerequisite list
E N D
makefile M.A Doman
What is the make utility? • make is a standard linux command to automatically determine when parts of a large project require recompilation • Governed by a set of rules built in a makefile • # indicates comment line target: prerequisite list [TAB] construction command
make clean target • Used to clean up the directory • In makefile: Clean: rmlist the object files you want removed. \ continue on next line.
make: using variables and comments You can also use variables when writing makefiles. # Comment that will say I’m creating a variable for compiler CC = g++ # Comment for a set of option flags used for compilation CFLAGS = -c # Link final program final: main.odeck.obox.o $(CC) –o final main.odeck.obox.o #compile main main.o: main.cpp $(CC) $(CFLAGS) main.cpp
make: using variables and comments You can also use variables when writing makefiles. # Comments that help me remember what I’m doing #clean directory # -f ignores nonexistent files without prompt # -r removes directories and contents recursively clean: rm–fr *.o final
Makefile lab • Continue now with makefile lab
UNIX Tutorial The following comes from the site: UNIX Tutorial for Beginners By the University of Surrey
Files and Processes • Everything in UNIX is either a file or a process. • A process is an executing program identified by a unique PID (process identifier). • A file is a collection of data. They are created by users using text editors, running compilers etc.