Ex33: Makefile Link and egrep

Hi All,

Doing exercise 33, I bumped into some things that did not work for me. So I will just note it for anyone to benefit from.

  1. I changed the line CFLAGS += $(TARGET) to LDLIBS += $(TARGET). Otherwise I get errors on compile.
  2. I changed the line with egrep below check to be one line only. If split with a backslash (as in the book) I get an error about the backslash and make check does not work. Removing the backslash and combining the two lines into one line solved the problem. Be careful not to add extra characters (spaces f.i.) by accident.

Kind regards. Guus.

EDIT: Adding the diff between the c-skeleton/Makefile and ex33/Makefile I have

> TARGET=build/liblcthw.a
< tests: CFLAGS += $(TARGET)
> tests: LDLIBS += $(TARGET)
< 	@egrep '[^_.>a-zA-Z0-9](str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)\
< 		|stpn?cpy|a?sn?printf|byte_)' $(SOURCES) || true
> 	@egrep -n '[^_.>a-zA-Z0-9](str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)|stpn?cpy|a?sn?printf|byte_)' $(SOURCES) ||     true
1 Like

Yes I believe this should now be an official change. The other way works on most places but a lot of compilers and linkers have become more strict about what goes where so it’s failing.