Target to generate assembly

This commit is contained in:
Imbus 2024-06-23 14:27:23 +02:00
parent d640180231
commit 4851f85f85

View file

@ -8,6 +8,7 @@ CFLAGS += -Wno-unused-but-set-variable -Wno-unused-value -Wno-unused-label
C_SOURCES = $(wildcard *.c) C_SOURCES = $(wildcard *.c)
C_HEADERS = $(wildcard *.h) C_HEADERS = $(wildcard *.h)
OBJECTS = $(C_SOURCES:.c=.o) OBJECTS = $(C_SOURCES:.c=.o)
ASMS = $(C_SOURCES:.c=.s)
all: $(OBJECTS) all: $(OBJECTS)
@ -15,10 +16,16 @@ all: $(OBJECTS)
@echo "CC $<" @echo "CC $<"
@$(CC) $(CFLAGS) -c $< -o $@ @$(CC) $(CFLAGS) -c $< -o $@
%.s: %.c $(C_HEADERS)
@echo "CC $<"
@$(CC) $(CFLAGS) -S -masm=intel $<
clean: clean:
rm -f $(OBJECTS) rm -f $(OBJECTS)
asm: $(ASMS)
format: format:
clang-format -i $(C_SOURCES) $(C_HEADERS) clang-format -i $(C_SOURCES) $(C_HEADERS)
.PHONY: all clean format .PHONY: all clean format asm