8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Makefileテンプレ

Posted at
# Makefile

# プログラム名とオブジェクトファイル名
TARGET = sandbox
OBJS = main.o

# 定義済マクロの再定義
CC = llvm-gcc
CFLAGS = -g -Wall
LDFLAGS = -lstdc++

# サフィックスルール適用対象の拡張子の定義
.SUFFIXES: .cpp .o

# プライマリターゲット
.PHONY: all
all: depend $(TARGET)

# プログラムの生成ルール
$(TARGET): $(OBJS)
	$(CC) $(LDFLAGS) -o $(TARGET) $^
	ls -al $(TARGET)

# サフィックスルール
.cpp.o:
	$(CC) $(CFLAGS) -c $<

# ファイル削除用ターゲット
.PHONY: clean
clean:
	$(RM) $(TARGET) $(OBJS) depend.inc

# 実行
.PHONY: run
run:
	./$(TARGET)

depend:
	makedepend *.h *.cpp


8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?