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