-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
85 lines (71 loc) · 2.23 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Polyglot in make and nmake
# ref. https://stackoverflow.com/a/30906085
#\
!if 1 #\
# [[[nmake]]] \
CFLAGS=/TC #\
CXXFLAGS=/EHsc #\
LIBNAME=odstream.lib #\
LIBSNAME=odstream_s.lib #\
LIBARG=$(LIBNAME) #\
LIBSARG=$(LIBSNAME) #\
RM=del #\
RMARGS=*.obj *.lib *.exe *.ilk *.pdb #\
LINKARG=-MD -Fe#\
LINKSARG=-MT -Fe#\
!else
# [[[make]]]
LIBNAME=libodstream.a
LIBSNAME=libodstream.a
LIBARG=-L. -lodstream
LIBSARG=-L. -lodstream
RM=-rm -rf
RMARGS=*.o *.a *.exe
LINKARG= -o
LINKSARG=-static -o
#\
!endif
########################################################################
#
# Common
all: $(LIBNAME) $(LIBSNAME)
clean:
$(RM) $(RMARGS)
buildptest:
$(CXX) $(CXXFLAGS) -D DEBUG $(LINKARG)testp_wd_cpp test_odprintf.c
$(CXX) $(CXXFLAGS) $(LINKARG)testp_nd_cpp test_odprintf.c
$(CC) $(CFLAGS) -D DEBUG $(LINKARG)testp_wd_c test_odprintf.c
$(CC) $(CFLAGS) $(LINKARG)testp_nd_c test_odprintf.c
buildtest: $(LIBNAME)
$(CXX) $(CXXFLAGS) $(LINKARG)test_blank blank.cpp
$(CXX) $(CXXFLAGS) $(LINKARG)test_nd_who test_odstream.cpp
$(CXX) $(CXXFLAGS) $(LINKARG)test_nd_nho -D YAK_DEBUG_NO_HEADER_ONLY test_odstream.cpp $(LIBARG)
$(CXX) $(CXXFLAGS) $(LINKARG)test_wd_who -D DEBUG test_odstream.cpp
$(CXX) $(CXXFLAGS) $(LINKARG)test_wd_nho -D DEBUG -D YAK_DEBUG_NO_HEADER_ONLY test_odstream.cpp $(LIBARG)
buildstatictest: $(LIBSNAME)
$(CXX) $(CXXFLAGS) $(LINKSARG)test_blank_s blank.cpp
$(CXX) $(CXXFLAGS) $(LINKSARG)test_nd_who_s test_odstream.cpp
$(CXX) $(CXXFLAGS) $(LINKSARG)test_nd_nho_s -D YAK_DEBUG_NO_HEADER_ONLY test_odstream.cpp $(LIBSARG)
$(CXX) $(CXXFLAGS) $(LINKSARG)test_wd_who_s -D DEBUG test_odstream.cpp
$(CXX) $(CXXFLAGS) $(LINKSARG)test_wd_nho_s -D DEBUG -D YAK_DEBUG_NO_HEADER_ONLY test_odstream.cpp $(LIBSARG)
########################################################################
#
# UNIX-ish
# Use conditional guard because nmake complains $^
#\
!if 0
libodstream.a: odstream.o
$(AR) r $@ $^
#\
!endif
########################################################################
#
# Windows
odstream.lib: odstream_md.obj
lib /out:$@ $**
odstream_s.lib: odstream_mt.obj
lib /out:$@ $**
odstream_md.obj: odstream.cpp
$(CXX) $(CXXFLAGS) -MD -c -Fo$@ $**
odstream_mt.obj: odstream.cpp
$(CXX) $(CXXFLAGS) -MT -c -Fo$@ $**