-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
105 lines (79 loc) · 2.94 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#
# ArgX - Better command line processing for Windows.
#
# Copyright (c) 2019 Alastair J. Houghton.
#
#
# N.B. This makefile is for GNU Make
#
$(info +--------------------------------------------------------------------+)
$(info | |)
$(info | ArgX - Better command line processing for Windows |)
$(info | |)
$(info | Copyright (c) 2019 Alastair J. Houghton. |)
$(info | |)
$(info +--------------------------------------------------------------------+)
$(info )
# Set up for Visual C++
include msvc.mk
CFLAGS:=-nologo -O1 -W4 -WX -Iinclude
CPPFLAGS:=$(CFLAGS) -EHsc
LIBSRCS:=ArgxCreateProcess.cpp \
ArgxCreateProcessA.cpp \
ArgxGetArguments.cpp \
ArgxGetArgumentsA.cpp \
ArgxFindExecutable.cpp \
ArgxFindExecutableA.cpp \
ArgxIsSupportedByExecutable.cpp \
utils.cpp
HEADERS:=include/ArgX.h src/PEB.hpp src/utils.hpp
LIB32OBJS:=$(LIBSRCS:%.cpp=build/x86/%.obj)
LIB64OBJS:=$(LIBSRCS:%.cpp=build/x64/%.obj)
TESTLIBS:=kernel32.lib shell32.lib shlwapi.lib advapi32.lib
TESTPROGS:=argxtest argxrun argxwhich argxsupported
TESTEXES:=$(TESTPROGS:%=build/x86/%a.exe) $(TESTPROGS:%=build/x86/%w.exe) \
$(TESTPROGS:%=build/x64/%a.exe) $(TESTPROGS:%=build/x64/%w.exe)
UNICODE:=-DUNICODE -D_UNICODE
export INCLUDE
build/x86/%.obj: src/%.cpp
@if [[ ! -d build/x86 ]]; then mkdir -p build/x86; fi
$(CL32) -c $(CPPFLAGS) -Fo$@ $<
build/x64/%.obj: src/%.cpp
@if [[ ! -d build/x64 ]]; then mkdir -p build/x64; fi
$(CL64) -c $(CPPFLAGS) -Fo$@ $<
build/x86/%a.exe: export LIB=$(LIB32)
build/x86/%a.exe: test/%.cpp lib/ArgX32.lib
@if [[ ! -d build/x86 ]]; then mkdir -p build/x86; fi
$(CL32) $(CPPFLAGS) -Fobuild/x86/ -Fe$@ $^ $(TESTLIBS)
build/x64/%a.exe: export LIB=$(LIB64)
build/x64/%a.exe: test/%.cpp lib/ArgX64.lib
@if [[ ! -d build/x64 ]]; then mkdir -p build/x64; fi
$(CL64) $(CPPFLAGS) -Fobuild/x64/ -Fe$@ $^ $(TESTLIBS)
build/x86/%w.exe: export LIB=$(LIB32)
build/x86/%w.exe: test/%.cpp lib/ArgX32.lib
@if [[ ! -d build/x86 ]]; then mkdir -p build/x86; fi
$(CL32) $(UNICODE) $(CPPFLAGS) -Fobuild/x86/ -Fe$@ $^ $(TESTLIBS)
build/x64/%w.exe: export LIB=$(LIB64)
build/x64/%w.exe: test/%.cpp lib/ArgX64.lib
@if [[ ! -d build/x64 ]]; then mkdir -p build/x64; fi
$(CL64) $(UNICODE) $(CPPFLAGS) -Fobuild/x64/ -Fe$@ $^ $(TESTLIBS)
.PHONY: all libs clean test tests dist doc
all: libs
libs: lib/ArgX32.lib lib/ArgX64.lib
clean:
$(RM) -rf build lib/*
tests: $(TESTEXES)
test: tests
scripts/test.sh
dist: libs
scripts/make-dist.sh
doc:
$(MAKE) -C doc html
$(LIB32OBJS): $(HEADERS)
$(LIB64OBJS): $(HEADERS)
lib/ArgX32.lib: $(LIB32OBJS)
@if [[ ! -d lib ]]; then mkdir -p lib; fi
$(AR) -nologo -out:$@ $(LIB32OBJS)
lib/ArgX64.lib: $(LIB64OBJS)
@if [[ ! -d lib ]]; then mkdir -p lib; fi
$(AR) -nologo -out:$@ $(LIB64OBJS)