Minimal Makefile
# build shared library with -fPIC, -shared
CFLAGS = -g # -O3 -fPIC # CXXFLAGS for .cpp
CPPFLAGS = -MMD -MP # -I../foo
LDFLAGS = # -L../foo -Wl,-rpath,'$$ORIGIN/../foo' # -shared
LDLIBS = # -lfoo
#CC = $(CXX) # link with CXX for .cpp
# target name is basename of one of the source files
main : $(patsubst %.c,%.o,$(wildcard *.c)) # .cpp
-include *.d
clean : ; -rm -fr *.o *.d
.PHONY : clean