tracy/standalone/build/unix/build.mk

56 lines
1.6 KiB
Makefile
Raw Normal View History

2017-09-15 20:45:23 +00:00
CFLAGS +=
2018-05-07 23:21:19 +00:00
CXXFLAGS := $(CFLAGS) -std=c++17
2017-09-15 20:45:23 +00:00
DEFINES +=
2017-10-01 00:37:52 +00:00
INCLUDES := $(shell pkg-config --cflags glfw3 gtk+-2.0) -I../../../imgui -I../../libs/gl3w
LIBS := $(shell pkg-config --libs glfw3 gtk+-2.0) -lpthread -ldl -lGL
PROJECT := Tracy
IMAGE := $(PROJECT)-$(BUILD)
2017-09-15 20:45:23 +00:00
2017-10-01 00:37:52 +00:00
FILTER := ../../../nfd/nfd_win.cpp
2017-09-15 20:45:23 +00:00
BASE := $(shell egrep 'ClCompile.*cpp"' ../win32/$(PROJECT).vcxproj | sed -e 's/.*\"\(.*\)\".*/\1/' | sed -e 's@\\@/@g')
BASE2 := $(shell egrep 'ClCompile.*c"' ../win32/$(PROJECT).vcxproj | sed -e 's/.*\"\(.*\)\".*/\1/' | sed -e 's@\\@/@g')
2017-09-15 20:45:23 +00:00
SRC := $(filter-out $(FILTER),$(BASE))
2017-10-01 00:37:52 +00:00
SRC2 := $(filter-out $(FILTER),$(BASE2)) ../../../nfd/nfd_gtk.c
2017-09-15 20:45:23 +00:00
OBJDIRBASE := obj/$(BUILD)
OBJDIR := $(OBJDIRBASE)/o/o/o
OBJ := $(addprefix $(OBJDIR)/,$(SRC:%.cpp=%.o))
OBJ2 := $(addprefix $(OBJDIR)/,$(SRC2:%.c=%.o))
2017-09-15 20:45:23 +00:00
all: $(IMAGE)
$(OBJDIR)/%.o: %.cpp
2017-09-15 20:45:23 +00:00
$(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@
$(OBJDIR)/%.d : %.cpp
2017-09-15 20:45:23 +00:00
@echo Resolving dependencies of $<
@mkdir -p $(@D)
@$(CXX) -MM $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< > $@.$$$$; \
sed 's,.*\.o[ :]*,$(OBJDIR)/$(<:.cpp=.o) $@ : ,g' < $@.$$$$ > $@; \
2017-09-15 20:45:23 +00:00
rm -f $@.$$$$
$(OBJDIR)/%.o: %.c
2017-09-15 20:45:23 +00:00
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
$(OBJDIR)/%.d : %.c
2017-09-15 20:45:23 +00:00
@echo Resolving dependencies of $<
@mkdir -p $(@D)
@$(CC) -MM $(INCLUDES) $(CFLAGS) $(DEFINES) $< > $@.$$$$; \
sed 's,.*\.o[ :]*,$(OBJDIR)/$(<:.c=.o) $@ : ,g' < $@.$$$$ > $@; \
2017-09-15 20:45:23 +00:00
rm -f $@.$$$$
$(IMAGE): $(OBJ) $(OBJ2)
$(CXX) $(CXXFLAGS) $(DEFINES) $(OBJ) $(OBJ2) $(LIBS) -o $@
ifneq "$(MAKECMDGOALS)" "clean"
-include $(addprefix $(OBJDIR)/,$(SRC:.cpp=.d)) $(addprefix $(OBJDIR)/,$(SRC2:.c=.d))
2017-09-15 20:45:23 +00:00
endif
clean:
rm -rf $(OBJDIRBASE) $(IMAGE)*
2017-09-15 20:45:23 +00:00
.PHONY: clean all