10
Add makefile
jonroach 1 Sep 2025 14:43
1 contributor
24 lines437 bytes
1# Basic Makefile for a C program with multiple source files and header dependencies
2
3CC = gcc
4CFLAGS = -Wall -Wextra -g -O0 -MMD -MP -std=c17
5SRC = $(wildcard coroutine/*.c) $(wildcard examples/*.c)
6OBJ = $(SRC:.c=.o)
7DEP = $(OBJ:.o=.d)
8TARGET = main
9
10all: $(TARGET)
11
12$(TARGET): $(OBJ)
13 $(CC) $(CFLAGS) -o $@ $^
14
15%.o: %.c
16 $(CC) $(CFLAGS) -I include -c $< -o $@
17
18-include $(DEP)
19
20clean:
21 rm -f $(OBJ) $(DEP) $(TARGET)
22
23.PHONY: all clean
24