Annotation of nono/Makefile.rule, revision 1.1.1.4

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.4 ! root       45: .if "${CSRCS_all}" != ""
        !            46: CSRCS_all=     ${CSRCS}
        !            47: .endif
        !            48: 
        !            49: .if "${CXXSRCS_all}" != ""
        !            50: CXXSRCS_all=   ${CXXSRCS}
        !            51: .endif
        !            52: 
1.1       root       53: all:   ${TARGETS}
                     54: 
                     55: .PHONY: clean
                     56: clean:
                     57:        rm -rf ${TARGETS} *.o ${CLEANFILES}
                     58: 
                     59: .PHONY: cleandir
                     60: cleandir:
                     61:        rm -rf .depends ${CLEANDIRFILES}
                     62: 
                     63: .PHONY: install
                     64: install:
                     65: 
                     66: .PHONY: depend
                     67: .if "${CSRCS}" != "" || "${CXXSRCS}" != ""
                     68: .PHONY: ${CSRCS:.c=.d} ${CXXSRCS:.cpp=.d}
                     69: depend: ${CSRCS:.c=.d} ${CXXSRCS:.cpp=.d}
                     70:        cat ${.ALLSRC} > .depends
                     71:        rm -f *.d
                     72: .endif
                     73: 
                     74: .for f in ${CSRCS}
                     75: ${f:.c=.d}:
                     76:        ${CC} ${CPPFLAGS} -E -MM $f > $@
                     77: .endfor
                     78: .for f in ${CXXSRCS}
                     79: ${f:.cpp=.d}:
                     80:        ${CXX} ${CPPFLAGS} -E -MM $f > $@
                     81: .endfor
                     82: 
                     83: .if exists(${.CURDIR}/.depends)
                     84: .include "${.CURDIR}/.depends"
                     85: .endif
                     86: 
1.1.1.4 ! root       87: .PHONY: show-files
        !            88: show-files:
        !            89:        @echo ${CSRCS} ${CXXSRCS}
        !            90: 
        !            91: .PHONY:        show-allfiles
        !            92: show-allfiles:
        !            93:        @echo ${CSRCS_all} ${CXXSRCS_all}
        !            94: 
1.1       root       95: .c.o:
1.1.1.2   root       96:        ${CC}  ${CFLAGS}   ${CFLAGS.$<}   ${CPPFLAGS} ${CPPFLAGS.$<} ${COPT} -c $< -o $@
1.1       root       97: 
                     98: .cpp.o:
1.1.1.2   root       99:        ${CXX} ${CXXFLAGS} ${CXXFLAGS.$<} ${CPPFLAGS} ${CPPFLAGS.$<} ${COPT} -c $< -o $@

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.