Skip to content

Instantly share code, notes, and snippets.

@devlights
Last active August 14, 2025 06:17
Show Gist options
  • Save devlights/327fd337398e18886d0e3a09b7ea0ee6 to your computer and use it in GitHub Desktop.
Save devlights/327fd337398e18886d0e3a09b7ea0ee6 to your computer and use it in GitHub Desktop.
C言語用のシンプルなMakefile
UseTab: Always
IndentWidth: 4
TabWidth: 4
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
CC = gcc
CPPFLAGS = -I.
CFLAGS = -Wall -Wextra -std=c99 -g -DDEBUG -O0
LDFLAGS =
LDLIBS =
TARGET = app
SRCS = app.c
OBJS = $(SRCS:.c=.o)
.DEFAULT_GOAL := run
fmt:
clang-format -i $(SRCS)
build: $(TARGET)
run: build
./$(TARGET)
clean:
$(RM) $(TARGET) $(OBJS)
$(TARGET): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
.PHONY: fmt run build clean
@devlights
Copy link
Author

devlights commented Aug 14, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment