2012-10-03 82 views
0

我正在使用此预制makefile。我尝试为添加到应用程序中的那两个文件添加heavyhitter.o和heavyhitter.h,但我无法使其工作。我已经添加了metadata_record.h和metadata_record.o,没有问题,并且由于我添加到了同一个区域,所以我不确定它为什么在以前工作,但现在不是。Makefile不起作用 - 添加新文件

 
CC = $(shell if test -f /opt/local/bin/gcc-mp-4.7; then \ 
     echo gcc-mp-4.7; else echo gcc; fi) 
CFLAGS = -std=gnu99 -g -W -Wall -O0 -gstabs -Iglib-2.0 -lglib-2.0 

TESTS = $(patsubst %.c,%,$(sort $(wildcard test[0-9][0-9][0-9].c))) 

%.o: %.c m61.h memory.h metadata_record.h heavyhitters.h 
    $(CC) $(CFLAGS) -o [email protected] -c $ 


all: $(TESTS) hhtest 
    @echo "*** Run 'make check' or 'make check-all' to check your work." 

test%: test%.o m61.o memory.o metadata_record.o heavyhitters.o 
    $(CC) $(CFLAGS) -o [email protected] $^ 

test017: test017-help.o 

hhtest: hhtest.o m61.o memory.o metadata_record.o heavyhitters.o 
    $(CC) $(CFLAGS) -o [email protected] $^ -lm 

check: $(TESTS) $(patsubst %,check-%,$(TESTS)) 
    @echo "*** All tests succeeded!" 

check-all: $(TESTS) 
    @x=true; for i in $(TESTS); do $(MAKE) check-$$i || x=false; done; \ 
    if $$x; then echo "*** All tests succeeded!"; fi; $$x 

check-test%: test% 
    @test -d out || mkdir out 
    @rm -f out/test$*.fail 
    @-sh -c "./$^ > out/test$*.output 2>&1" >/dev/null 2>&1; true 
    @perl compare.pl out/test$*.output test$*.c test$* 

clean: 
    rm -f $(TESTS) hhtest *.o 
    rm -rf out 

MALLOC_CHECK_=0 
export MALLOC_CHECK_ 

.PRECIOUS: %.o 
.PHONY: all clean check check-% prepare-check 
+0

使用'remake'运行'改造-x'甚至'改造-x -d'调试'Makefile' –

+1

的是什么样的方式它不工作? – John3136

+0

我得到了“make:***没有规则来制作'test001'所需的'heavyhitters.o'。停止。”我的系统上没有重拍命令。 – user994165

回答

0

它实际上应该是heavyhitter不heavyhitters