ws2801d/Makefile
Thomas Kolb dda7385517 Adaptation for 160 LED strip
WARNING: This includes an incompatbile protocol change: The module index and
the action are now in separate bytes, as 8 bits are needed for the module
index.

Also, the module index is now 32 bit internally to make future upgrades easier.
2017-01-29 15:45:52 +00:00

85 lines
2 KiB
Makefile

# --- START OF CONFIG ---------------------------------------------------
# Edit the following variables for your own needs
# toolchain configuration
CXX=gcc
LD=gcc
# default build configuration
# "make BUILD=release" does a release build
BUILD:=debug
# basic build flags configuration
CFLAGS+=-std=c99 -Wall -pedantic -Wno-long-long -D_POSIX_C_SOURCE=20120607L -D_FILE_OFFSET_BITS=64 -pthread
LIBS+=-lm -lrt -pthread
# library specific flags
# wiringPi
CFLAGS+=
LIBS+=-lwiringPi
# build type specific flags
CFLAGS_debug=-O0 -ggdb -DDEBUG
LIBS_debug=
CFLAGS_release=-Os -pipe -march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard
LIBS_release=
# target configuration
TARGET := ws2801d
VERSION := 0.0.0
VCSVERSION := $(shell git rev-parse --short HEAD)
# source files for the project
SOURCE := $(shell find src/ -name '*.c')
INCLUDES := $(shell find include/ -name '*.h')
# install destination directory
DESTDIR ?= /usr/local
# --- END OF CONFIG -----------------------------------------------------
OBJ1=$(patsubst %.c, %.o, $(SOURCE))
OBJ=$(patsubst src/%, obj/$(BUILD)/%, $(OBJ1))
VERSIONSTR="\"$(VERSION)-$(VCSVERSION)\""
CFLAGS+=-Iinclude -DVERSION=$(VERSIONSTR)
TARGETFILE := bin/$(BUILD)/$(TARGET)
all: $(TARGET)
CFLAGS+=$(CFLAGS_$(BUILD))
LIBS+=$(LIBS_$(BUILD))
.PHONY show_cflags:
@echo --- Build parameters: ------------------------------------------
@echo CFLAGS\=$(CFLAGS)
@echo LIBS\=$(LIBS)
@echo SOURCE\=$(SOURCE)
@echo -----------------------------------------------------------------
$(TARGET): show_cflags $(TARGETFILE)
@echo ">>> $(BUILD) build complete."
$(TARGETFILE): $(OBJ) $(INCLUDES) Makefile
@echo Linking $@ ...
@mkdir -p $(shell dirname $@)
@$(LD) -o $(TARGETFILE) $(OBJ) $(LIBS)
obj/$(BUILD)/%.o: src/%.c $(INCLUDES) Makefile
@echo Compiling $< ...
@mkdir -p $(shell dirname $@)
@$(CXX) -c $(CFLAGS) -o $@ $<
doc:
doxygen doxygen.conf
clean:
rm -f $(TARGETFILE)
rm -f $(OBJ)
install: all
install -m 755 $(TARGETFILE) $(DESTDIR)/bin/