user994165
user994165

Reputation: 9502

Makefile not working - Adding new files

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

Upvotes: 0

Views: 573

Answers (1)

user994165
user994165

Reputation: 9502

It was actually supposed to be heavyhitter not heavyhitters

Upvotes: 0

Related Questions