35 lines
601 B
Makefile
35 lines
601 B
Makefile
BUILD_DIR = build
|
|
|
|
CFLAGS += -std=gnu99 -W -Wall -pedantic
|
|
CFLAGS += -Wstrict-prototypes -Wundef -Werror
|
|
CFLAGS += -ffunction-sections
|
|
CFLAGS += -Os -g
|
|
CFLAGS += -DNEXA_PIN=29
|
|
|
|
LDFLAGS += -lwiringPi
|
|
|
|
srcs += main.c
|
|
srcs += nexa_new.c
|
|
|
|
objs = $(srcs:%.c=${BUILD_DIR}/%.o)
|
|
|
|
target = nexa
|
|
|
|
${BUILD_DIR}/%.o: %.c
|
|
@echo "[CC] $< -> $@"
|
|
@$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
|
$(target): $(BUILD_DIR) $(objs)
|
|
@echo "[LINK] $@"
|
|
@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(objs)
|
|
|
|
${BUILD_DIR}:
|
|
@mkdir -p $@
|
|
|
|
clean:
|
|
@rm -rf $(objs) $(asm_objs) $(target) $(target.elf) ${BUILD_DIR}
|
|
|
|
.PHONY: clean
|
|
|
|
-include $(srcs:%.c=%.d)
|