|
|
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: #
27: # CLEANFILES
28: # make clean で削除する追加のファイル。
29: #
30: # CLEANDIRFILES
31: # make cleandir で削除する追加のファイル。
32:
33: all: ${TARGETS}
34:
35: .PHONY: clean
36: clean:
37: rm -rf ${TARGETS} *.o ${CLEANFILES}
38:
39: .PHONY: cleandir
40: cleandir:
41: rm -rf .depends ${CLEANDIRFILES}
42:
43: ${BINDIR}:
44: mkdir -p ${BINDIR}
45:
46: .PHONY: install
47: install:
48:
49: .PHONY: depend
50: .if "${CSRCS}" != "" || "${CXXSRCS}" != ""
51: .PHONY: ${CSRCS:.c=.d} ${CXXSRCS:.cpp=.d}
52: depend: ${CSRCS:.c=.d} ${CXXSRCS:.cpp=.d}
53: cat ${.ALLSRC} > .depends
54: rm -f *.d
55: .endif
56:
57: .for f in ${CSRCS}
58: ${f:.c=.d}:
59: ${CC} ${CPPFLAGS} -E -MM $f > $@
60: .endfor
61: .for f in ${CXXSRCS}
62: ${f:.cpp=.d}:
63: ${CXX} ${CPPFLAGS} -E -MM $f > $@
64: .endfor
65:
66: .if exists(${.CURDIR}/.depends)
67: .include "${.CURDIR}/.depends"
68: .endif
69:
70: .c.o:
71: ${CC} ${CFLAGS} ${CFLAGS.$<} ${CPPFLAGS} ${CPPFLAGS.$<} -c $< -o $@
72:
73: .cpp.o:
74: ${CXX} ${CXXFLAGS} ${CXXFLAGS.$<} ${CPPFLAGS} ${CPPFLAGS.$<} -c $< -o $@
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.