This repository has been archived on 2024-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
probotic/GNUmakefile

47 lines
893 B
Makefile
Raw Normal View History

2023-08-02 10:29:19 -04:00
.POSIX: # Just kidding, use GNU Make
# OVERRIDE ME #
PREFIX := .
PROGN := probotic
CC := cc
CFLAGS := -std=c99 -Wall -Wextra -Wpedantic
2023-08-02 10:52:59 -04:00
CPPFLAGS := -I/usr/bin/ircclient/ -Iinclude
2023-08-02 10:29:19 -04:00
LDFLAGS := -lircclient
SRC.DIR := src
OBJ.DIR := $(PREFIX)/obj
2023-08-02 10:52:59 -04:00
INC.DIR := include
2023-08-02 10:29:19 -04:00
2023-08-02 10:52:59 -04:00
OBJ := $(addprefix $(OBJ.DIR)/,fetch.o main.o creds_parser.o)
2023-08-02 11:09:34 -04:00
HDR := config.h utils.h creds_parser.h
2023-08-02 10:29:19 -04:00
VPATH := $(INC.DIR) $(SRC.DIR) $(OBJ.DIR)
ifeq ($(DEBUG),1)
CFLAGS += -Og -g3
else
CFLAGS += -O3 -flto=auto -fomit-frame-pointer
endif
ifdef SAN
CFLAGS += -fsanitize=$(SAN)
endif
CPPFLAGS += -DPROGN="\"$(PROGN)\""
$(OBJ.DIR)/%.o: $(SRC.DIR)/%.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
$(PREFIX)/$(PROGN): $(VPATH) $(PREFIX) $(HDR) | $(OBJ)
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $| $(LDFLAGS)
2023-08-02 11:09:34 -04:00
include/config.h: include/config.mk.h
cp -f $< $@
2023-08-02 10:29:19 -04:00
$(VPATH) $(PREFIX):
mkdir -p $@
clean:
$(RM) $(OBJ) $(PROGN)