|
|
1.1 root 1: #
2: # nono
3: # Copyright (C) 2020 nono project
4: # Licensed under nono-license.txt
5: #
6:
7: # 共通のルール。
8: # サブディレクトリの Makefile の末尾で .include すること。
9:
10: # 必要に応じて以下の変数を定義しておく。
11: #
12: # TARGETS
13: # ターゲット。複数でもよい。
14: # ターゲットをビルドするためのルールは各自で定義のこと。
15: #
16: # CSRCS
17: # ターゲットをビルドするための C ソース。
18: #
19: # CXXSRCS
20: # ターゲットをビルドするための C++ ソース。
21: #
22: # CFLAGS.{srcfile}
23: # CXXFLAGS.{srcfile}
24: # CPPFLAGS.{srcfile}
25: # 個別のソースファイルに適用するオプション。
26: #
1.1.1.2 ! root 27: # COPT
! 28: # C/C++ ソースコンパイル時に指定する追加のオプション。
! 29: # すべてのオプションより後ろで出力する。
! 30: #
1.1 root 31: # CLEANFILES
32: # make clean で削除する追加のファイル。
33: #
34: # CLEANDIRFILES
35: # make cleandir で削除する追加のファイル。
36:
37: all: ${TARGETS}
38:
39: .PHONY: clean
40: clean:
41: rm -rf ${TARGETS} *.o ${CLEANFILES}
42:
43: .PHONY: cleandir
44: cleandir:
45: rm -rf .depends ${CLEANDIRFILES}
46:
47: ${BINDIR}:
48: mkdir -p ${BINDIR}
49:
50: .PHONY: install
51: install:
52:
53: .PHONY: depend
54: .if "${CSRCS}" != "" || "${CXXSRCS}" != ""
55: .PHONY: ${CSRCS:.c=.d} ${CXXSRCS:.cpp=.d}
56: depend: ${CSRCS:.c=.d} ${CXXSRCS:.cpp=.d}
57: cat ${.ALLSRC} > .depends
58: rm -f *.d
59: .endif
60:
61: .for f in ${CSRCS}
62: ${f:.c=.d}:
63: ${CC} ${CPPFLAGS} -E -MM $f > $@
64: .endfor
65: .for f in ${CXXSRCS}
66: ${f:.cpp=.d}:
67: ${CXX} ${CPPFLAGS} -E -MM $f > $@
68: .endfor
69:
70: .if exists(${.CURDIR}/.depends)
71: .include "${.CURDIR}/.depends"
72: .endif
73:
74: .c.o:
1.1.1.2 ! root 75: ${CC} ${CFLAGS} ${CFLAGS.$<} ${CPPFLAGS} ${CPPFLAGS.$<} ${COPT} -c $< -o $@
1.1 root 76:
77: .cpp.o:
1.1.1.2 ! root 78: ${CXX} ${CXXFLAGS} ${CXXFLAGS.$<} ${CPPFLAGS} ${CPPFLAGS.$<} ${COPT} -c $< -o $@
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.