LedBars/RpiLedBars/Makefile

38 lines
909 B
Makefile
Raw Normal View History

2021-07-28 22:26:40 +02:00
CC := gcc
2021-09-29 23:49:12 +02:00
CFLAGS := -Wall -g -Ilibs/log.c/src -Ilibs/wsServer/include
LDFLAGS := -L.libs -lws -lwiringPi -lasound -lfftw3 -lpthread -lm
2021-07-28 22:26:40 +02:00
SRC := src
OBJ := obj
BIN := bin/pixled
SOURCES := $(shell find $(SRC) -type f -name "*.c")
2021-07-28 22:26:40 +02:00
OBJECTS := $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SOURCES))
.PHONY: all clean install
2021-07-30 11:04:45 +02:00
2021-07-28 22:26:40 +02:00
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 $@
2021-07-28 22:26:40 +02:00
$(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