31 lines
624 B
Makefile
31 lines
624 B
Makefile
# SPDX-License-Identifier: MIT
|
|
|
|
CC = gcc
|
|
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
|
|
|
|
C_SOURCES = $(wildcard *.c)
|
|
C_HEADERS = $(wildcard *.h)
|
|
OBJECTS = $(C_SOURCES:.c=.o)
|
|
ASMS = $(C_SOURCES:.c=.s)
|
|
|
|
all: $(OBJECTS)
|
|
|
|
%.o: %.c $(C_HEADERS)
|
|
@echo "CC $<"
|
|
@$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
%.s: %.c $(C_HEADERS)
|
|
@echo "CC $<"
|
|
@$(CC) $(CFLAGS) -S -masm=intel $<
|
|
|
|
clean:
|
|
rm -f $(OBJECTS) $(ASMS)
|
|
|
|
asm: $(ASMS)
|
|
|
|
format:
|
|
clang-format -i $(C_SOURCES) $(C_HEADERS)
|
|
|
|
.PHONY: all clean format asm
|