|
|
1.1 root 1: #
2: # nono
3: # Copyright (C) 2018 [email protected]
4: #
5:
6: .include "Makefile.cfg"
7:
8: PROFOPT= -g
9: #PROFOPT= -g -pg
10:
11: ## ASan for GCC
12: #PROFOPT+= -fsanitize=address -fno-omit-frame-pointer -static-libstdc++
13: ## ASan for clang
14: #PROFOPT+= -fsanitize=address -fno-omit-frame-pointer -O1
15: ## MSan for clang
16: #PROFOPT+= -fsanitize=memory -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 -O1
17: ## TSan
18: #PROFOPT+= -fsanitize=thread
19: ## UBSan
20: #PROFOPT+= -fsanitize=undefined
21:
22: # CFLAGS は c/c++ 共通のコンパイルオプション
23: # CXXFLAGS は CFLAGS に追加する c++ 専用のコンパイルオプション
24: # CPPFLAGS は c/c++ 共通のプリプロセッサオプション
25:
26: CXX+= -std=c++11
27:
28: CFLAGS+= -O2
29: CFLAGS+= ${PROFOPT}
30: CFLAGS+= -Wall -Werror -Wshadow
31: CFLAGS+= -Wno-sign-compare
32: CFLAGS+= -Wno-unused-result
33: CFLAGS+= -Wpointer-arith
34:
35: .if ${NETDRIVER} == "tap"
36: CFLAGS+= -DNETDRIVER_TAP
37: .endif
38: .if ${NETDRIVER} == "bpf"
39: CFLAGS+= -DNETDRIVER_BPF
40: .endif
41:
42: CXXFLAGS+= -Wnon-virtual-dtor
43:
1.1.1.2 ! root 44: CPPFLAGS+= -I.
! 45: CPPFLAGS+= -I..
! 46: CPPFLAGS+= -I../debugger
! 47: CPPFLAGS+= -I../fpe
! 48: CPPFLAGS+= -I../host
! 49: CPPFLAGS+= -I../lib
! 50: CPPFLAGS+= -I../m680x0
! 51: CPPFLAGS+= -I../m88xx0
! 52: CPPFLAGS+= -I../vm
! 53:
1.1 root 54: LDFLAGS+= ${PROFOPT}
55:
56: # リンカに指定する引数
57: MYLIBS= \
58: ../vm/libnnvm.a \
59: ../debugger/libnndebugger.a \
60: ../m680x0/libnnm680x0.a \
1.1.1.2 ! root 61: ../m88xx0/libnnm88xx0.a \
1.1 root 62: ../fpe/libnnfpe.a \
63: ../host/libnnhost.a \
64: ../lib/libnnlib.a \
65:
1.1.1.2 ! root 66: .if "${.MAKE.OS}" == "Darwin"
! 67: # Apple Clang は --start-group, --end-group に対応してない。うーん。
! 68: MYLIBS_GROUP= ${MYLIBS} ${MYLIBS}
! 69: .else
! 70: MYLIBS_GROUP= -Wl,--start-group ${MYLIBS} -Wl,--end-group
! 71: .endif
! 72:
! 73: LIBS+= -lz
! 74:
1.1 root 75: all: ${TARGETS}
76:
77: .PHONY: clean
78: clean:
79: rm -rf ${TARGETS} *.o ${CLEANFILES}
80:
81: .PHONY: cleandir
82: cleandir:
83: rm -rf .depends ${CLEANDIRFILES}
84:
85: .PHONY: depend
86: .if "${CSRCS}" != "" || "${CXXSRCS}" != ""
87: .PHONY: ${CSRCS:.c=.d} ${CXXSRCS:.cpp=.d}
88: depend: ${CSRCS:.c=.d} ${CXXSRCS:.cpp=.d}
89: cat ${.ALLSRC} > .depends
90: rm -f *.d
91: .endif
92:
93: .for f in ${CSRCS}
94: ${f:.c=.d}:
95: ${CC} ${CPPFLAGS} -E -MM $f > $@
96: .endfor
97: .for f in ${CXXSRCS}
98: ${f:.cpp=.d}:
99: ${CXX} ${CPPFLAGS} -E -MM $f > $@
100: .endfor
101:
102: .if exists(${.CURDIR}/.depends)
103: .include "${.CURDIR}/.depends"
104: .endif
105:
106: .c.o:
107: ${CC} ${CFLAGS} ${CPPFLAGS} ${CFLAGS.$<} ${CPPFLAGS.$<} -c $< -o $@
108:
109: .cpp.o:
110: ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS.$<} ${CPPFLAGS.$<} -c $< -o $@
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.