diff --git a/.gitignore b/.gitignore index c893ffb0..15fa4d4f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ Debug imgui.ini test/tracy_test test/tracy_test.exe +*/build/unix/*-* diff --git a/capture/build/unix/build.mk b/capture/build/unix/build.mk index 9fb2956e..380601dc 100644 --- a/capture/build/unix/build.mk +++ b/capture/build/unix/build.mk @@ -3,49 +3,53 @@ CXXFLAGS := $(CFLAGS) -std=gnu++17 DEFINES += -DTRACY_NO_STATISTICS INCLUDES := LIBS := -lpthread -IMAGE := capture +PROJECT := capture +IMAGE := $(PROJECT)-$(BUILD) FILTER := -BASE := $(shell egrep 'ClCompile.*cpp"' ../win32/$(IMAGE).vcxproj | sed -e 's/.*\"\(.*\)\".*/\1/' | sed -e 's@\\@/@g') -BASE2 := $(shell egrep 'ClCompile.*c"' ../win32/$(IMAGE).vcxproj | sed -e 's/.*\"\(.*\)\".*/\1/' | sed -e 's@\\@/@g') +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') SRC := $(filter-out $(FILTER),$(BASE)) SRC2 := $(filter-out $(FILTER),$(BASE2)) -OBJ := $(SRC:%.cpp=%.o) -OBJ2 := $(SRC2:%.c=%.o) +OBJDIRBASE := obj/$(BUILD) +OBJDIR := $(OBJDIRBASE)/o/o/o + +OBJ := $(addprefix $(OBJDIR)/,$(SRC:%.cpp=%.o)) +OBJ2 := $(addprefix $(OBJDIR)/,$(SRC2:%.c=%.o)) all: $(IMAGE) -%.o: %.cpp +$(OBJDIR)/%.o: %.cpp $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@ -%.d : %.cpp +$(OBJDIR)/%.d : %.cpp @echo Resolving dependencies of $< @mkdir -p $(@D) @$(CXX) -MM $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< > $@.$$$$; \ - sed 's,.*\.o[ :]*,$(<:.cpp=.o) $@ : ,g' < $@.$$$$ > $@; \ + sed 's,.*\.o[ :]*,$(OBJDIR)/$(<:.cpp=.o) $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$ -%.o: %.c +$(OBJDIR)/%.o: %.c $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ -%.d : %.c +$(OBJDIR)/%.d : %.c @echo Resolving dependencies of $< @mkdir -p $(@D) @$(CC) -MM $(INCLUDES) $(CFLAGS) $(DEFINES) $< > $@.$$$$; \ - sed 's,.*\.o[ :]*,$(<:.c=.o) $@ : ,g' < $@.$$$$ > $@; \ + sed 's,.*\.o[ :]*,$(OBJDIR)/$(<:.c=.o) $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$ $(IMAGE): $(OBJ) $(OBJ2) $(CXX) $(CXXFLAGS) $(DEFINES) $(OBJ) $(OBJ2) $(LIBS) -o $@ ifneq "$(MAKECMDGOALS)" "clean" --include $(SRC:.cpp=.d) $(SRC2:.c=.d) +-include $(addprefix $(OBJDIR)/,$(SRC:.cpp=.d)) %(addprefix $(OBJDIR)/,$(SRC2:.c=.d)) endif clean: - rm -f $(OBJ) $(OBJ2) $(SRC:.cpp=.d) $(SRC2:.c=.d) $(IMAGE) + rm -rf $(OBJDIRBASE) $(IMAGE)* .PHONY: clean all diff --git a/capture/build/unix/debug.mk b/capture/build/unix/debug.mk index 5a4e17b3..04d925a6 100644 --- a/capture/build/unix/debug.mk +++ b/capture/build/unix/debug.mk @@ -2,6 +2,7 @@ ARCH := $(shell uname -m) CFLAGS := -g3 -Wall DEFINES := -DDEBUG +BUILD := debug ifeq ($(ARCH),x86_64) CFLAGS += -msse4.1 diff --git a/capture/build/unix/release.mk b/capture/build/unix/release.mk index 1c820a6e..030063e3 100644 --- a/capture/build/unix/release.mk +++ b/capture/build/unix/release.mk @@ -2,6 +2,7 @@ ARCH := $(shell uname -m) CFLAGS := -O3 -s -fomit-frame-pointer DEFINES := -DNDEBUG +BUILD := release ifeq ($(ARCH),x86_64) CFLAGS += -msse4.1 diff --git a/standalone/build/unix/build.mk b/standalone/build/unix/build.mk index 604d7c6d..436cf6de 100644 --- a/standalone/build/unix/build.mk +++ b/standalone/build/unix/build.mk @@ -3,49 +3,53 @@ CXXFLAGS := $(CFLAGS) -std=c++17 DEFINES += 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 -IMAGE := Tracy +PROJECT := Tracy +IMAGE := $(PROJECT)-$(BUILD) FILTER := ../../../nfd/nfd_win.cpp -BASE := $(shell egrep 'ClCompile.*cpp"' ../win32/$(IMAGE).vcxproj | sed -e 's/.*\"\(.*\)\".*/\1/' | sed -e 's@\\@/@g') -BASE2 := $(shell egrep 'ClCompile.*c"' ../win32/$(IMAGE).vcxproj | sed -e 's/.*\"\(.*\)\".*/\1/' | sed -e 's@\\@/@g') +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') SRC := $(filter-out $(FILTER),$(BASE)) SRC2 := $(filter-out $(FILTER),$(BASE2)) ../../../nfd/nfd_gtk.c -OBJ := $(SRC:%.cpp=%.o) -OBJ2 := $(SRC2:%.c=%.o) +OBJDIRBASE := obj/$(BUILD) +OBJDIR := $(OBJDIRBASE)/o/o/o + +OBJ := $(addprefix $(OBJDIR)/,$(SRC:%.cpp=%.o)) +OBJ2 := $(addprefix $(OBJDIR)/,$(SRC2:%.c=%.o)) all: $(IMAGE) -%.o: %.cpp +$(OBJDIR)/%.o: %.cpp $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@ -%.d : %.cpp +$(OBJDIR)/%.d : %.cpp @echo Resolving dependencies of $< @mkdir -p $(@D) @$(CXX) -MM $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< > $@.$$$$; \ - sed 's,.*\.o[ :]*,$(<:.cpp=.o) $@ : ,g' < $@.$$$$ > $@; \ + sed 's,.*\.o[ :]*,$(OBJDIR)/$(<:.cpp=.o) $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$ -%.o: %.c +$(OBJDIR)/%.o: %.c $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ -%.d : %.c +$(OBJDIR)/%.d : %.c @echo Resolving dependencies of $< @mkdir -p $(@D) @$(CC) -MM $(INCLUDES) $(CFLAGS) $(DEFINES) $< > $@.$$$$; \ - sed 's,.*\.o[ :]*,$(<:.c=.o) $@ : ,g' < $@.$$$$ > $@; \ + sed 's,.*\.o[ :]*,$(OBJDIR)/$(<:.c=.o) $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$ $(IMAGE): $(OBJ) $(OBJ2) $(CXX) $(CXXFLAGS) $(DEFINES) $(OBJ) $(OBJ2) $(LIBS) -o $@ ifneq "$(MAKECMDGOALS)" "clean" --include $(SRC:.cpp=.d) $(SRC2:.c=.d) +-include $(addprefix $(OBJDIR)/,$(SRC:.cpp=.d)) $(addprefix $(OBJDIR)/,$(SRC2:.c=.d)) endif clean: - rm -f $(OBJ) $(OBJ2) $(SRC:.cpp=.d) $(SRC2:.c=.d) $(IMAGE) + rm -rf $(OBJDIRBASE) $(IMAGE)* .PHONY: clean all diff --git a/standalone/build/unix/debug.mk b/standalone/build/unix/debug.mk index 5a4e17b3..04d925a6 100644 --- a/standalone/build/unix/debug.mk +++ b/standalone/build/unix/debug.mk @@ -2,6 +2,7 @@ ARCH := $(shell uname -m) CFLAGS := -g3 -Wall DEFINES := -DDEBUG +BUILD := debug ifeq ($(ARCH),x86_64) CFLAGS += -msse4.1 diff --git a/standalone/build/unix/release.mk b/standalone/build/unix/release.mk index 1c820a6e..030063e3 100644 --- a/standalone/build/unix/release.mk +++ b/standalone/build/unix/release.mk @@ -2,6 +2,7 @@ ARCH := $(shell uname -m) CFLAGS := -O3 -s -fomit-frame-pointer DEFINES := -DNDEBUG +BUILD := release ifeq ($(ARCH),x86_64) CFLAGS += -msse4.1