ringbuf/Makefile

53 lines
1.2 KiB
Makefile
Raw Normal View History

2024-06-23 14:08:44 +02:00
# SPDX-License-Identifier: MIT
CC = gcc
2024-06-30 05:28:58 +02:00
CFLAGS = -Wall -Wextra -Werror -Wno-unused-parameter
CFLAGS += -Wno-unused-variable -Wno-unused-function
CFLAGS += -Wno-unused-but-set-variable -Wno-unused-value -Wno-unused-label
CFLAGS += -Wno-unused-result -Wno-unused-const-variable
2024-06-27 01:21:25 +02:00
2024-06-30 21:11:30 +02:00
ifneq ($(DEBUG), 1)
2024-06-30 05:28:58 +02:00
CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables -fno-ident
CFLAGS += -fno-unwind-tables -fno-stack-protector -fno-plt -fno-pic
CFLAGS += -O3 -std=c99 -march=native -mtune=native -fomit-frame-pointer
else
CFLAGS += -g -O0 -std=c99 -march=native -mtune=native
CFLAGS += -DDEBUG
2024-06-30 05:28:58 +02:00
endif
2024-06-27 01:21:25 +02:00
# Include debug flags
CFLAGS += -g -O0 -std=c99 -march=native -mtune=native
2024-06-23 14:08:44 +02:00
C_SOURCES = $(wildcard *.c)
C_HEADERS = $(wildcard *.h)
OBJECTS = $(C_SOURCES:.c=.o)
2024-06-23 14:27:23 +02:00
ASMS = $(C_SOURCES:.c=.s)
2024-06-23 14:08:44 +02:00
all: $(OBJECTS)
%.o: %.c $(C_HEADERS)
@echo "CC $<"
@$(CC) $(CFLAGS) -c $< -o $@
2024-06-23 14:27:23 +02:00
%.s: %.c $(C_HEADERS)
@echo "CC $<"
@$(CC) $(CFLAGS) -S -masm=intel $<
2024-06-23 16:27:51 +02:00
driver: $(OBJECTS)
@$(CC) $(CFLAGS) $^ -o $@
run: driver
@./driver
2024-06-23 14:08:44 +02:00
clean:
2024-06-27 00:00:11 +02:00
rm -f $(OBJECTS) $(ASMS) driver
2024-06-23 14:08:44 +02:00
asm: $(ASMS) $(OBJECTS)
wc -l $(ASMS)
size $(OBJECTS)
2024-06-23 14:27:23 +02:00
2024-06-23 14:08:44 +02:00
format:
clang-format -i $(C_SOURCES) $(C_HEADERS)
2024-06-23 14:44:19 +02:00
.PHONY: all clean format asm