1
0
Fork 0
forked from auxolotl/templates
auxolotl-templates/c/Makefile
2024-05-06 23:40:01 +02:00

36 lines
439 B
Makefile

.POSIX:
.SUFFIXES: .o
CC ?= gcc
OUT := hello
SRC += main.c
OBJ := $(SRC:.c=.o)
CFLAGS += @compile_flags.txt
CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS := -fwhole-program -flto
LDFLAGS += -Wl,--gc-sections -s
RM ?= rm -f
.DEFAULT_GOAL: all
.PHONY: all
all: $(OUT)
$(OUT): $(OBJ)
$(CC) -o $@ $<
.PHONY: clean
clean:
$(RM) $(OBJ)
.PHONY: fclean
fclean: clean
$(RM) -r $(OUT)
.PHONY: re
.NOTPARALLEL: re
re: fclean all