Understanding Make in C -
i seasoned developer in java , had learned c in college days, brushing c skill , following tutorial here
i trying follow tutorial on makefile here author says:
does file ex1 exist already? no. ok, there file starts ex1? yes, it's called ex1.c. know how build .c files? yes, run command cc ex1.c -o ex1 build them. shall make 1 ex1 using cc build ex1.c.
but unable grasp, makefile , why used? parameters same? cflags? cc? new ubuntu although.
good explanation long.
short explanation: makefile set of instructions on how compile / build executable. includes relationships. example, "executable needs object files b , c. b compiled files x.c x.h y.c , y.h; c depends on k.c". if modifies k.c, know need recompile c don't need recompile b (just link b , c @ end).
as projects more complicated becomes more important.
as flags - there kinds of ways control compiler. want change these - say, want include more debug, or increase level of optimization; or change target architecture. these things controlled flags. setting variable contain these flags, can replace flags in many commands @ same time. can change compiler want use - might have different ones source code might contain more 1 language (mixtures of c , fortran still encountered in many numerical analysis libraries, example.)
cc
c compiler. gcc
(the gnu c compiler). other compilers include g++
(for c++), g77
(for fortran77), etc...
all of means using makefile great maintaining control , flexibility when compiling large , complex projects.
but - need read , not rely on written late @ night...
Comments
Post a Comment