CC := gcc CFLAGS := -Wall -g -Ilibs/log.c/src -Ilibs/wsServer/include LDFLAGS := -L.libs -lws -lwiringPi -lasound -lfftw3 -lpthread -lm SRC := src OBJ := obj BIN := bin/pixled SOURCES := $(shell find $(SRC) -type f -name "*.c") OBJECTS := $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SOURCES)) .PHONY: all clean install all: $(BIN) libs/log.c/obj/log.o: libs/log.c/src/log.c if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi $(CC) -c $< -o $@ -DLOG_USE_COLOR .libs/log.la: libs/log.c/obj/log.o if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi ar r $@ $^ ranlib $@ $(OBJ)/%.o: $(SRC)/%.c if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi $(CC) -c $< -o $@ $(CFLAGS) $(BIN): $(OBJECTS) .libs/log.la if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi $(CC) -o $@ $^ $(LDFLAGS) install: $(shell install --backup bin/pixled /usr/local/bin/) clean: rm -rf $(OBJ) .libs libs/*/obj