dwmblocks/Makefile

54 lines
1.0 KiB
Makefile
Raw Normal View History

2021-03-20 10:52:45 +01:00
.POSIX:
2023-04-01 07:51:42 +02:00
BIN := dwmblocks
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
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
LDLIBS := -lX11
2022-08-24 16:34:53 +02: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-04-06 02:48:16 +02:00
INSTALL_DIR := $(DESTDIR)$(PREFIX)/bin
2023-04-01 07:51:42 +02:00
# Prettify output
PRINTF := @printf "%-8s %s\n"
ifeq ($(VERBOSE), 0)
Q := @
endif
all: $(BUILD_DIR)/$(BIN)
$(BUILD_DIR)/$(BIN): $(OBJS)
2023-04-01 07:51:42 +02:00
$(PRINTF) "LD" $@
$Q$(LINK.o) $^ $(LDLIBS) -o $@
$(BUILD_DIR)/%.o: %.c config.h | $(BUILD_DIR)
2023-04-01 07:51:42 +02:00
$(PRINTF) "CC" $@
$Q$(COMPILE.c) -o $@ $<
$(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-06 02:48:16 +02:00
$(PRINTF) "CLEAN" $(BUILD_DIR)
$Q$(RM) $(BUILD_DIR)/*
2022-08-24 16:34:53 +02: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
.PHONY: all clean install uninstall