-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile.linux
More file actions
53 lines (38 loc) · 1.72 KB
/
Copy pathMakefile.linux
File metadata and controls
53 lines (38 loc) · 1.72 KB
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
cmake:
cmake -B build . $(if $(D),-DCMAKE_BUILD_TYPE=Debug,-DCMAKE_BUILD_TYPE=Release) $(CMAKEARGS)
$(MAKE) -C build $(if $(V),VERBOSE=1)
dirname=$(dir $(patsubst %/,%,$1))
boostasiohpp=$(firstword $(wildcard $(addsuffix /include/boost/asio.hpp,/usr/local /opt/local $(wildcard /usr/local/opt/boost*) /usr)))
BOOSTDIR=$(call dirname,$(call dirname,$(call dirname,$(boostasiohpp))))
BOOSTINC=$(firstword $(wildcard $(BOOSTDIR)/include $(BOOSTDIR)))
# note: on windows: pass CXX=cl and BOOSTDIR=c:/local/boost_1_xx_y on the make commandline
cpputilssplit=$(firstword $(wildcard $(addsuffix /string-split.h, cpputils submodules/cpputils ../cpputils ../../cpputils)))
CPPUTILSDIR=$(call dirname,$(cpputilssplit))
hdmachmemory=$(firstword $(wildcard $(addsuffix /machmemory.h, hexdumper submodules/hexdumper ../hexdumper ../../hexdumper)))
HEXDUMPERDIR=$(call dirname,$(hdmachmemory))
ifneq ($(wildcard /System/Library/Extensions),)
OSTYPE=darwin
endif
ifneq ($(wildcard $(SystemRoot)/explorer.exe $(SYSTEMROOT)/explorer.exe),)
OSTYPE=windows
endif
LDFLAGS+=-L/usr/local/lib -lboost_regex
LDFLAGS+=$(if $(filter $(OSTYPE),darwin),-framework Security)
findstr: findstr.o $(if $(filter $(OSTYPE),darwin),machmemory.o)
%: %.o
$(CXX) -g -o $@ $^ -O3 -L$(BOOSTDIR)/lib $(LDFLAGS)
INCS=-I $(CPPUTILSDIR) -I $(HEXDUMPERDIR) -I $(BOOSTINC)
CFLAGS+=-Wall -g $(if $(D),-O0,-O3)
CFLAGS+=$(if $(filter $(OSTYPE),windows),-std:c++17,-std=c++17)
CFLAGS+=-DUSE_BOOST_REGEX
#CFLAGS+=-DUSE_STD_REGEX
#CFLAGS+=-DWITH_MEMSEARCH
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $^ $(INCS)
%.o: $(HEXDUMPERDIR)/%.cpp
$(CXX) $(CFLAGS) -c -o $@ $^ $(INCS)
clean:
$(RM) findstr $(wildcard *.o)
$(RM) -r build CMakeFiles CMakeCache.txt CMakeOutput.log
installbin:
cp findstr ~/bin/