Operating System/System Programming(Arif Butt)

Lec04) UNIX make utility

Tony Lim 2021. 6. 12. 12:51
728x90
myexe:hello.o
	gcc hello.o -o myexe
hello.o:hello.c
	gcc -c hello.c

this makefile.  by executing command "gcc hello.o -o myexe" hello.o will be myexe. and same for second line.

by looking at modify time make command can tell whether it need to compile it or not

if hello.c 's modify time is yonger than hello.o make command will compile.

notice it only compile that is not up to date.

 

you can execute clean command by "make clean" , other commands are same.

included d1/makefile , which mean it will also execute d1/makefile too when we type make command.

we can also use macro to simplify modification whe we need.

other macro that can be use in makefile. 

728x90