开发者

makefile concepts

开发者 https://www.devze.com 2023-03-14 04:36 出处:网络
can anyoone help me. this is the code for make file i\'m just trying to save different objective files at different directories is that possible?

can anyoone help me. this is the code for make file i'm just trying to save different objective files at different directories is that possible? in the below code.

OBJECTS = objj/mall.o objj/fall.o 

BACK = kajj/ball.o kajj/call.o

DIR = objj kajj rajj 

execc/gola : $(OBJECTS) $(BACK)
    g开发者_如何学JAVAcc $^  -o  $@
$(OBJECTS):objj/%.o:%.c
    mkdir   $(DIR)
    gcc -c  $<  -o  $@
$(BACK) : kajj/%.o

i want to save the mall.o fall.o in objj and ball.o and call.o in kajj i'm stucked up here i dont know how to cotinue further can anyone help me if we use %.o:%.c it replaces all obj files one on one but how to seperate them. and anyone please tell me what these line really does $(OBJECTS):objj/%.o:%.c.im unable to understand we can have only one colon in our line but here we have two im confused help me out guys


For the two column rules, consider what is before the first as the actual targets, and what is after the first column as a pattern rule.

Thus, to compile the objects in kajj, you could replace your last rule by:

$(BACK): kajj/%.o: %.c
    mkdir   $(DIR)
    gcc -c  $<  -o  $@
0

精彩评论

暂无评论...
验证码 换一张
取 消