-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrule1
More file actions
67 lines (59 loc) · 1.82 KB
/
rule1
File metadata and controls
67 lines (59 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
3个头文件 8个C文件
———v1——
edit : main.o kbd.o command.o display.o \insert.o search.o files.o utils.o cc -o edit main.o kbd.o command.o display.o \insert.o search.o files.o utils.omain.o : main.c defs.h cc -c main.ckbd.o : kbd.c defs.h command.h cc -c kbd.ccommand.o : command.c defs.h command.h cc -c command.cdisplay.o : display.c defs.h buffer.h cc -c display.cinsert.o : insert.c defs.h buffer.h cc -c insert.csearch.o : search.c defs.h buffer.h cc -c search.cfiles.o : files.c defs.h buffer.h command.h cc -c files.c
utils.o : utils.c defs.h cc -c utils.cclean :rm edit main.o kbd.o command.o display.o \insert.o search.o files.o utils.o
———v1——
“edit” is the final executable file. It rely on Intermediate object files which are
main.o kbd.o command.o display.o insert.o search.o files.o utils.o.
Inorder to make this makefile maintainable. We could define a variable
objects = main.o kbd.o command.o display.o\
insert.o search.o files.o utils.o #We could this objects to replace these “.o” file.
———v2——
objects = main.o kbd.o command.o display.o \insert.o search.o files.o utils.oedit : $(objects) cc -o edit $(objects)main.o : main.c defs.h cc -c main.ckbd.o : kbd.c defs.h command.h cc -c kbd.ccommand.o : command.c defs.h command.h cc -c command.cdisplay.o : display.c defs.h buffer.h cc -c display.cinsert.o : insert.c defs.h buffer.h cc -c insert.csearch.o : search.c defs.h buffer.h cc -c search.cfiles.o : files.c defs.h buffer.h command.h cc -c files.cutils.o : utils.c defs.h cc -c utils.cclean :rm edit $(objects)
—-—v2——
——v3—-
It is OK to reduce the number of repeatedly used .h or .o file. There is another version to put these repeated file into one place. But it makes the makefile unclear.
Currently, do not do that.
——v3—