So I am attempting to clean up my makefile and have run into an issue.
I am receiving the errors:
parser.c:18: undefined reference to `parser1'
parser.c:20: undefined reference to `parser2'
And this is my makefile:
Code:
CC=gcc
CFLAGS=-std=c99 -g3 -Wall
parser: parser.o parsers.a
$(CC) $(CFLAGS) -o parser parser.o parsers.a
parser.o: parser.c parser.h
$(CC) $(CFLAGS) -c parser.c
parsers.a: parser1.a parser2.a parse_misc.o
ar cr parsers.a parser1.a parser2.a parse_misc.o
parser1.a: parser1.c parser1.h constants.h packet1.o
$(CC) $(CFLAGS) -c parser1.c
ar cr parser1.a parser1.o packet1.o
parser2.a: parser2.c parser2.h constants.h packet2.o
$(CC) $(CFLAGS) -c parser2.c
ar cr parser2.a parser2.o packet2.o
packet1.o: packet1.c packet1.h constants.h
$(CC) $(CFLAGS) -c packet1.c
packet2.o: packet2.c packet2.h constants.h
$(CC) $(CFLAGS) -c packet2.c
parse_misc.o: parse_misc.c parse_misc.h
$(CC) $(CFLAGS) -c parse_misc.c
clean:
rm -f *.o *.a *~ parser
I have an old makefile that works just fine so I know the problem is not with missing '#include's or some other code related problem, it is a problem with my makefile.