I hate bmake
This commit is contained in:
parent
5b269aa405
commit
a7b6cd8e89
46
GNUmakefile
Normal file
46
GNUmakefile
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
.POSIX: # Just kidding, use GNU Make
|
||||||
|
|
||||||
|
# OVERRIDE ME #
|
||||||
|
PREFIX := .
|
||||||
|
PROGN := probotic
|
||||||
|
|
||||||
|
CC := cc
|
||||||
|
CFLAGS := -std=c99 -Wall -Wextra -Wpedantic
|
||||||
|
CPPFLAGS := -I/usr/bin/ircclient/
|
||||||
|
LDFLAGS := -lircclient
|
||||||
|
|
||||||
|
SRC.DIR := src
|
||||||
|
OBJ.DIR := $(PREFIX)/obj
|
||||||
|
# INC.DIR := include
|
||||||
|
|
||||||
|
OBJ := $(addprefix $(OBJ.DIR)/,fetch.o main.o)
|
||||||
|
# HDR :=
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
# include/config.h: include/config.mk.h
|
||||||
|
# cp -f $< $@
|
||||||
|
|
||||||
|
$(VPATH) $(PREFIX):
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(OBJ) $(PROGN)
|
44
Makefile
44
Makefile
@ -1,7 +1,4 @@
|
|||||||
.POSIX: # Just kidding, use GNU Make
|
|
||||||
|
|
||||||
# OVERRIDE ME #
|
# OVERRIDE ME #
|
||||||
PREFIX := .
|
|
||||||
PROGN := probotic
|
PROGN := probotic
|
||||||
|
|
||||||
CC := cc
|
CC := cc
|
||||||
@ -10,37 +7,42 @@ CPPFLAGS := -I/usr/bin/ircclient/
|
|||||||
LDFLAGS := -lircclient
|
LDFLAGS := -lircclient
|
||||||
|
|
||||||
SRC.DIR := src
|
SRC.DIR := src
|
||||||
OBJ.DIR := $(PREFIX)/obj
|
OBJ.DIR := obj
|
||||||
# INC.DIR := include
|
# INC.DIR := include
|
||||||
|
|
||||||
OBJ := $(addprefix $(OBJ.DIR)/,fetch.o main.o)
|
SRC := fetch.c main.c
|
||||||
|
OBJ := ${OBJ.DIR}/fetch.o ${OBJ.DIR}/main.o
|
||||||
# HDR :=
|
# HDR :=
|
||||||
|
|
||||||
VPATH := $(INC.DIR) $(SRC.DIR) $(OBJ.DIR)
|
VPATH := ${INC.DIR}:${SRC.DIR}:${OBJ.DIR}
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
.if "${DEBUG}" == "1"
|
||||||
CFLAGS += -Og -g3
|
CFLAGS := ${CFLAGS} -Og -g3
|
||||||
else
|
.else
|
||||||
CFLAGS += -O3 -flto=auto -fomit-frame-pointer
|
CFLAGS := ${CFLAGS} -O3 -flto=auto -fomit-frame-pointer
|
||||||
endif
|
.endif
|
||||||
|
|
||||||
ifdef SAN
|
.ifdef SAN
|
||||||
CFLAGS += -fsanitize=$(SAN)
|
CFLAGS := ${CFLAGS} -fsanitize=${SAN}
|
||||||
endif
|
.endif
|
||||||
|
|
||||||
CPPFLAGS += -DPROGN="\"$(PROGN)\""
|
CPPFLAGS := ${CPPFLAGS} -DPROGN="\"${PROGN}\""
|
||||||
|
|
||||||
$(OBJ.DIR)/%.o: $(SRC.DIR)/%.c
|
all: ${PROGN}
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
$(PREFIX)/$(PROGN): $(VPATH) $(PREFIX) $(HDR) | $(OBJ)
|
${PROGN}: ${OBJ.DIR} ${PREFIX} ${HDR} ${OBJ}
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $| $(LDFLAGS)
|
${CC} ${CFLAGS} ${CPPFLAGS} -o $@ ${OBJ} ${LDFLAGS}
|
||||||
|
|
||||||
|
${OBJ.DIR}/main.o: ${SRC.DIR}/main.c
|
||||||
|
${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ ${SRC.DIR}/main.c
|
||||||
|
${OBJ.DIR}/fetch.o: ${SRC.DIR}/fetch.c
|
||||||
|
${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ ${SRC.DIR}/fetch.c
|
||||||
|
|
||||||
# include/config.h: include/config.mk.h
|
# include/config.h: include/config.mk.h
|
||||||
# cp -f $< $@
|
# cp -f $< $@
|
||||||
|
|
||||||
$(VPATH) $(PREFIX):
|
${OBJ.DIR} ${PREFIX}:
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(OBJ) $(PROGN)
|
${RM} ${OBJ} ${PROGN}
|
||||||
|
Reference in New Issue
Block a user