2021-03-20 10:52:45 +01:00
|
|
|
.POSIX:
|
|
|
|
|
2023-04-01 07:51:42 +02:00
|
|
|
BIN := dwmblocks
|
2023-03-25 17:08:05 +01:00
|
|
|
BUILD_DIR := build
|
|
|
|
SRC_DIR := src
|
|
|
|
INC_DIR := inc
|
2022-08-24 16:34:53 +02:00
|
|
|
|
2023-04-01 07:51:42 +02:00
|
|
|
VERBOSE := 0
|
|
|
|
|
2023-03-25 17:08:05 +01:00
|
|
|
PREFIX := /usr/local
|
2023-04-01 07:51:42 +02:00
|
|
|
CFLAGS := -Wall -Wextra -Ofast -I. -I$(INC_DIR)
|
|
|
|
CFLAGS += -Wall -Wextra -Wno-missing-field-initializers
|
2023-03-25 17:08:05 +01:00
|
|
|
LDLIBS := -lX11
|
2022-08-24 16:34:53 +02:00
|
|
|
|
2023-03-25 17:08:05 +01:00
|
|
|
VPATH := $(SRC_DIR)
|
2023-03-30 03:34:11 +02:00
|
|
|
OBJS := $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c))
|
|
|
|
OBJS += $(patsubst %.c,$(BUILD_DIR)/%.o,$(wildcard *.c))
|
2023-03-25 17:08:05 +01:00
|
|
|
|
2023-04-01 07:51:42 +02:00
|
|
|
INSTALL_DIR := $(subst //,/,$(DESTDIR)/$(PREFIX)/bin)
|
|
|
|
|
|
|
|
# Prettify output
|
|
|
|
PRINTF := @printf "%-8s %s\n"
|
|
|
|
ifeq ($(VERBOSE), 0)
|
|
|
|
Q := @
|
|
|
|
endif
|
|
|
|
|
2023-03-25 17:08:05 +01:00
|
|
|
all: $(BUILD_DIR)/$(BIN)
|
|
|
|
|
|
|
|
$(BUILD_DIR)/$(BIN): $(OBJS)
|
2023-04-01 07:51:42 +02:00
|
|
|
$(PRINTF) "LD" $@
|
|
|
|
$Q$(LINK.o) $^ $(LDLIBS) -o $@
|
2023-03-25 17:08:05 +01:00
|
|
|
|
|
|
|
$(BUILD_DIR)/%.o: %.c config.h | $(BUILD_DIR)
|
2023-04-01 07:51:42 +02:00
|
|
|
$(PRINTF) "CC" $@
|
|
|
|
$Q$(COMPILE.c) -o $@ $<
|
2023-03-25 17:08:05 +01:00
|
|
|
|
|
|
|
$(BUILD_DIR):
|
2023-04-01 07:51:42 +02:00
|
|
|
$(PRINTF) "MKDIR" $@
|
|
|
|
$Qmkdir -p $@
|
2021-03-20 10:52:45 +01:00
|
|
|
|
|
|
|
clean:
|
2023-04-01 07:51:42 +02:00
|
|
|
$(PRINTF) "RM" $(BUILD_DIR)
|
|
|
|
$Q$(RM) -r $(BUILD_DIR)
|
2022-08-24 16:34:53 +02:00
|
|
|
|
2023-03-25 17:08:05 +01:00
|
|
|
install: $(BUILD_DIR)/$(BIN)
|
2023-04-01 07:51:42 +02:00
|
|
|
$(PRINTF) "INSTALL" $(INSTALL_DIR)/$(BIN)
|
|
|
|
$Qinstall -D -m 755 $< $(INSTALL_DIR)/$(BIN)
|
2022-08-24 16:34:53 +02:00
|
|
|
|
2021-03-20 10:52:45 +01:00
|
|
|
uninstall:
|
2023-04-01 07:51:42 +02:00
|
|
|
$(PRINTF) "RM" $(INSTALL_DIR)/$(BIN)
|
|
|
|
$Q$(RM) $(INSTALL_DIR)/$(BIN)
|
2021-03-20 10:52:45 +01:00
|
|
|
|
2023-03-25 17:08:05 +01:00
|
|
|
.PHONY: all clean install uninstall
|