Comment

Comment by gumby

With gnu make you don't even need OBJs for a simple directory in which all the .c files are compiled:

    .SECONDEXPANSION

    foo: $$(patsubst %.c,%.o,$$(wildcard *.c))
         $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
Admittedly you can end up with short, very general Makefiles that look like they were a Prolog program written in TECO. But the advantage is that they are general so don't need to be fiddled with as your project grows.

I make small Makefiles like this that ensure my local build environment is correct for the package, then call cmake.

parent gumby 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton