Skip to content

Instantly share code, notes, and snippets.

@airglow923
Last active December 9, 2021 04:06
Show Gist options
  • Save airglow923/1d9726808569038c9bfd3522c863ac15 to your computer and use it in GitHub Desktop.
Save airglow923/1d9726808569038c9bfd3522c863ac15 to your computer and use it in GitHub Desktop.
Simple Makefile
CC = clang
CFLAGS = -std=c11 -O0 -g3 -Wall -Wextra
ASAN_FLAGS = -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-recover=address
CSRC = $(wildcard *.c)
COBJ = $(patsubst %.c, %.o, $(CSRC))
.PHONY: all
all: main
.PHONY: main
main: $(COBJ)
$(CC) $(CFLAGS) $(ASAN_FLAGS) $< -o $@
%.o: %.c
$(CC) $(CFLAGS) $(ASAN_FLAGS) -c $< -o $@
.PHONY: clean
clean:
rm -rf *.o main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment