Last active
April 4, 2024 15:07
-
-
Save devlights/16a96258d3859b9d25876a536d07d4dd to your computer and use it in GitHub Desktop.
C言語でサンプル作る際のMakefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DESTDIR = . | |
PROGRAM = app | |
SRCS = $(shell find $(PWD) -name "*.c" -type f) | |
OBJS = $(SRCS:%.c=%.o) | |
CC = clang | |
INCDIRS = | |
CFLAGS = -g -O0 -Wall -Wextra -std=c17 | |
LDFLAGS = | |
LDLIBS = | |
%.o: %.c | |
$(CC) $(CFLAGS) -c $< -o $@ $(INCDIRS) | |
$(PROGRAM): $(OBJS) | |
$(CC) $(CFLAGS) $(LDFLAGS) -o $(DESTDIR)/$(PROGRAM) $(OBJS) $(LDLIBS) | |
.PHONY: build | |
build: $(PROGRAM) | |
.PHONY: clean | |
clean: | |
$(RM) $(OBJS) $(DESTDIR)/$(PROGRAM) | |
.PHONY: run | |
run: build | |
@$(DESTDIR)/$(PROGRAM) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment