mirror of
https://github.com/mintycube/dwmblocks.git
synced 2024-10-22 14:05:47 +02:00
54 lines
1.1 KiB
Makefile
54 lines
1.1 KiB
Makefile
.POSIX:
|
|
|
|
BIN := dwmblocks
|
|
BUILD_DIR := build
|
|
SRC_DIR := src
|
|
INC_DIR := include
|
|
|
|
VERBOSE := 0
|
|
LIBS := xcb-atom
|
|
|
|
PREFIX := /usr/local
|
|
CFLAGS := -Ofast -I. -I$(INC_DIR) -std=c99
|
|
CFLAGS += -DBINARY=\"$(BIN)\" -D_POSIX_C_SOURCE=200809L
|
|
CFLAGS += -Wall -Wpedantic -Wextra -Wswitch-enum
|
|
CFLAGS += $(shell pkg-config --cflags $(LIBS))
|
|
LDLIBS := $(shell pkg-config --libs $(LIBS))
|
|
|
|
SRCS := $(wildcard $(SRC_DIR)/*.c)
|
|
OBJS := $(subst $(SRC_DIR)/,$(BUILD_DIR)/,$(SRCS:.c=.o))
|
|
|
|
INSTALL_DIR := $(DESTDIR)$(PREFIX)/bin
|
|
|
|
# Prettify output
|
|
PRINTF := @printf "%-8s %s\n"
|
|
ifeq ($(VERBOSE), 0)
|
|
Q := @
|
|
endif
|
|
|
|
all: $(BUILD_DIR)/$(BIN)
|
|
|
|
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c config.h
|
|
$Qmkdir -p $(@D)
|
|
$(PRINTF) "CC" $@
|
|
$Q$(COMPILE.c) -o $@ $<
|
|
|
|
|
|
$(BUILD_DIR)/$(BIN): $(OBJS)
|
|
$(PRINTF) "LD" $@
|
|
$Q$(LINK.o) $^ $(LDLIBS) -o $@
|
|
|
|
clean:
|
|
$(PRINTF) "CLEAN" $(BUILD_DIR)
|
|
$Q$(RM) $(BUILD_DIR)/*
|
|
|
|
install: $(BUILD_DIR)/$(BIN)
|
|
$(PRINTF) "INSTALL" $(INSTALL_DIR)/$(BIN)
|
|
$Qinstall -D -m 755 $< $(INSTALL_DIR)/$(BIN)
|
|
|
|
uninstall:
|
|
$(PRINTF) "RM" $(INSTALL_DIR)/$(BIN)
|
|
$Q$(RM) $(INSTALL_DIR)/$(BIN)
|
|
|
|
.PHONY: all clean install uninstall
|