C_FILES = $(wildcard src/*.c) O_FILES = $(C_FILES:src/%.c=build/%.o) .PHONY: all clean .DEFAULT: all all: pihelper libpihelper: $(O_FILES) gcc -o $@ $^ pihelper: libpihelper gcc -o $@ $^ build: @mkdir -p build build/%.o: src/%.c | build gcc -c $< -o $@ clean: -rm -f $(O_FILES) -rm -f pihelper -rm -rf build