|
|
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
1.1.1.4 root 17: # nono をビルドするための C ソース。
18: #
19: # CSRCS_all
20: # テストなども含むすべてのターゲットをビルドするための C ソース。
21: # 定義されてなければこちらで ${CSRCS} を代入する。
1.1 root 22: #
23: # CXXSRCS
1.1.1.4 root 24: # nono をビルドするための C++ ソース。
25: #
26: # CXXSRCS_all
27: # テストなども含むすべてのターゲットをビルドするための C++ ソース。
28: # 定義されてなければこちらで ${CXXSRCS} を代入する。
1.1 root 29: #
30: # CFLAGS.{srcfile}
31: # CXXFLAGS.{srcfile}
32: # CPPFLAGS.{srcfile}
33: # 個別のソースファイルに適用するオプション。
34: #
1.1.1.2 root 35: # COPT
36: # C/C++ ソースコンパイル時に指定する追加のオプション。
37: # すべてのオプションより後ろで出力する。
38: #
1.1 root 39: # CLEANFILES
40: # make clean で削除する追加のファイル。
41: #
42: # CLEANDIRFILES
43: # make cleandir で削除する追加のファイル。
44:
1.1.1.5 ! root 45: CSRCS_all?= ${CSRCS}
! 46: CXXSRCS_all?= ${CXXSRCS}
1.1.1.4 root 47:
1.1 root 48: all: ${TARGETS}
49:
50: .PHONY: clean
51: clean:
52: rm -rf ${TARGETS} *.o ${CLEANFILES}
53:
54: .PHONY: cleandir
55: cleandir:
56: rm -rf .depends ${CLEANDIRFILES}
57:
58: .PHONY: install
59: install:
60:
61: .PHONY: depend
1.1.1.5 ! root 62: .if "${CSRCS_all}" != "" || "${CXXSRCS_all}" != ""
! 63: .PHONY: ${CSRCS_all:.c=.d} ${CXXSRCS_all:.cpp=.d}
! 64: depend: ${CSRCS_all:.c=.d} ${CXXSRCS_all:.cpp=.d}
1.1 root 65: cat ${.ALLSRC} > .depends
66: rm -f *.d
67: .endif
68:
1.1.1.5 ! root 69: .for f in ${CSRCS_all}
1.1 root 70: ${f:.c=.d}:
71: ${CC} ${CPPFLAGS} -E -MM $f > $@
72: .endfor
1.1.1.5 ! root 73: .for f in ${CXXSRCS_all}
1.1 root 74: ${f:.cpp=.d}:
75: ${CXX} ${CPPFLAGS} -E -MM $f > $@
76: .endfor
77:
78: .if exists(${.CURDIR}/.depends)
79: .include "${.CURDIR}/.depends"
80: .endif
81:
1.1.1.4 root 82: .PHONY: show-files
83: show-files:
84: @echo ${CSRCS} ${CXXSRCS}
85:
86: .PHONY: show-allfiles
87: show-allfiles:
88: @echo ${CSRCS_all} ${CXXSRCS_all}
89:
1.1 root 90: .c.o:
1.1.1.2 root 91: ${CC} ${CFLAGS} ${CFLAGS.$<} ${CPPFLAGS} ${CPPFLAGS.$<} ${COPT} -c $< -o $@
1.1 root 92:
93: .cpp.o:
1.1.1.2 root 94: ${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.