-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile_macosx
39 lines (32 loc) · 1.1 KB
/
Makefile_macosx
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
DEP_PKGS = xerces-c libcurl
# To setup:
# 1. Install https://brew.sh
# 2. Run: $ brew install pkg-config xerces-c libcurl
# 3. Run: $ make -f Makefile_macosx
SHELL = bash
CXX = g++
CPPFLAGS = -DUNIX_SYSTEM $(shell pkg-config --cflags $(DEP_PKGS))
CFLAGS = -Wall -g1 -O2
LFLAGS = $(shell pkg-config --libs $(DEP_PKGS)) -lpthread -framework CoreServices
bin_path = bin
dep_path = dep
VPATH = $(dep_path) $(bin_path)
executable = yafs
-include sources
objects = $(sources:%.cpp=%.o)
objects_with_path = $(sources:%.cpp=$(bin_path)/%.o)
dependences = $(sources:%.cpp=%.d)
dependences_with_path = $(sources:%.cpp=$(dep_path)/%.d)
$(executable) : $(dependences) $(objects)
$(CXX) $(CFLAGS) $(CPPFLAGS) $(objects_with_path) $(LFLAGS) -o $(bin_path)/$(executable)
.PHONY : clean
clean :
rm -f $(dependences_with_path) $(objects_with_path) $(bin_path)/$(executable)
-include $(dependences_with_path)
%.o : %.cpp
$(CXX) -c $(CFLAGS) $(CPPFLAGS) $< -o $(bin_path)/$@
$(dep_path)/%.d : %.cpp
@rm -f [email protected]
@$(CXX) -MM $(CPPFLAGS) $< > [email protected]
@sed 's,\($*\)\.o[ :]*,\1.o $@ : Makefile_macosx ,g' < [email protected] > $@
@rm -f [email protected]