Determines the directory lcoation of the project.
This commit is contained in:
parent
f49027b2d7
commit
b7d7614471
|
@ -1,12 +1,11 @@
|
||||||
|
project_dir := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))/../)
|
||||||
|
sources = $(wildcard $(project_dir)/oscar64/*.cpp)
|
||||||
sources = $(wildcard ../oscar64/*.cpp)
|
objects = $(patsubst $(project_dir)/oscar64/%.cpp,%.o,$(sources))
|
||||||
objects = $(patsubst ../oscar64/%.cpp,%.o,$(sources))
|
|
||||||
|
|
||||||
CXX = c++
|
CXX = c++
|
||||||
CPPFLAGS = -g -O2 -std=c++11 -Wno-switch
|
CPPFLAGS = -g -O2 -std=c++11 -Wno-switch
|
||||||
|
|
||||||
$(shell mkdir -p ../bin)
|
$(shell mkdir -p $(project_dir)/bin)
|
||||||
|
|
||||||
ifdef WINDIR
|
ifdef WINDIR
|
||||||
linklibs = -lpthread
|
linklibs = -lpthread
|
||||||
|
@ -24,21 +23,21 @@ else
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
%.o: ../oscar64/%.cpp
|
%.o: $(project_dir)/oscar64/%.cpp
|
||||||
$(CXX) -c $(CPPFLAGS) $< -o $@
|
$(CXX) -c $(CPPFLAGS) $< -o $@
|
||||||
|
|
||||||
%.d: ../oscar64/%.cpp
|
%.d: $(project_dir)/oscar64/%.cpp
|
||||||
@set -e; rm -f $@; \
|
@set -e; rm -f $@; \
|
||||||
$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
|
$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
||||||
rm -f $@.$$$$
|
rm -f $@.$$$$
|
||||||
|
|
||||||
../bin/oscar64 : $(objects)
|
$(project_dir)/bin/oscar64 : $(objects)
|
||||||
$(CXX) $(CPPFLAGS) $(objects) $(linklibs) -o ../bin/oscar64
|
$(CXX) $(CPPFLAGS) $(objects) $(linklibs) -o $(project_dir)/bin/oscar64
|
||||||
|
|
||||||
.PHONY : clean
|
.PHONY : clean
|
||||||
clean :
|
clean :
|
||||||
-rm *.o *.d ../bin/oscar64
|
-rm *.o *.d $(project_dir)/bin/oscar64
|
||||||
|
|
||||||
ifeq ($(UNAME_S), Darwin)
|
ifeq ($(UNAME_S), Darwin)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue