-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathMakefile
42 lines (34 loc) · 941 Bytes
/
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
ifeq ($(x32),1)
CPU = 32
else
CPU = 64
endif
SOURCES=AddInNative.cpp StrConv.cpp json.cpp
ifeq ($(macos),1)
TARGETDIR = "$(CURDIR)/macos/"
TARGET = $(TARGETDIR)RegExMac64.so
LIBPATHS = -Llib/macos/
LIBS= pcre2-16
else
TARGETDIR = $(CURDIR)/linux/x$(CPU)/
TARGET = $(TARGETDIR)RegEx$(CPU).so
LIBPATHS = -Llib/linux/x$(CPU)/
LIBS= pcre2-16
endif
OBJECTS=$(SOURCES:.cpp=.o)
INCLUDES=-Iinclude
CXXLAGS=$(CXXFLAGS) $(INCLUDES) -m$(CPU) -finput-charset=UTF-8 -fPIC -std=c++14 -O1
all: $(TARGET)
-include $(OBJECTS:.o=.d)
%.o: %.cpp
g++ -c $(CXXLAGS) $*.cpp -o $*.o
g++ -MM $(CXXLAGS) $*.cpp > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
$(TARGET): $(OBJECTS) Makefile
g++ $(CXXLAGS) $(LIBPATHS) -shared $(OBJECTS) -o $(TARGET) $(addprefix -l, $(LIBS))
clean:
rm -f $(CURDIR)/*.d $(CURDIR)/*.o