0
votes

I'm using this premade makefile. I tried adding heavyhitter.o and heavyhitter.h for those two files that I added to the application but I can't get it to work. I had added metadata_record.h and metadata_record.o without a problem and since I'm adding to the same area, I'm not sure why it worked before but isn't now.

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 $@ -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 $@ $^

test017: test017-help.o

hhtest: hhtest.o m61.o memory.o metadata_record.o heavyhitters.o
    $(CC) $(CFLAGS) -o $@ $^ -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
1
Use remake and run remake -x or even remake -x -d to debug a MakefileBasile Starynkevitch
in what way is it not working?John3136
I get "make: *** No rule to make target heavyhitters.o', needed by test001'. Stop." There is no remake command on my system.user994165
Is the file you added in the same folder as the other sources? if not, you may need to adjust the sources option for make to find them, or specify them by relative or absolute path (please, not the latter).WhozCraig
They're in the same directoryuser994165

1 Answers

0
votes

It was actually supposed to be heavyhitter not heavyhitters