Factor out makefile TBB detection, apply to all tools.

This commit is contained in:
Jim Blandy 2020-07-31 09:14:12 -07:00
parent a12bf2d753
commit 652582b119
6 changed files with 32 additions and 37 deletions

View File

@ -1,8 +1,10 @@
include ../../../common/unix.mk
CFLAGS += CFLAGS +=
CXXFLAGS := $(CFLAGS) -std=gnu++17 CXXFLAGS := $(CFLAGS) -std=gnu++17
DEFINES += -DTRACY_NO_STATISTICS DEFINES += -DTRACY_NO_STATISTICS
INCLUDES := $(shell pkg-config --cflags capstone) INCLUDES := $(shell pkg-config --cflags capstone)
LIBS := $(shell pkg-config --libs capstone) -lpthread LIBS += $(shell pkg-config --libs capstone) -lpthread
PROJECT := capture PROJECT := capture
IMAGE := $(PROJECT)-$(BUILD) IMAGE := $(PROJECT)-$(BUILD)
@ -14,11 +16,6 @@ BASE2 := $(shell egrep 'ClCompile.*c"' ../win32/$(PROJECT).vcxproj | sed -e 's/.
SRC := $(filter-out $(FILTER),$(BASE)) SRC := $(filter-out $(FILTER),$(BASE))
SRC2 := $(filter-out $(FILTER),$(BASE2)) SRC2 := $(filter-out $(FILTER),$(BASE2))
TBB := $(shell ld -ltbb -o /dev/null 2>/dev/null; echo $$?)
ifeq ($(TBB),0)
LIBS += -ltbb
endif
OBJDIRBASE := obj/$(BUILD) OBJDIRBASE := obj/$(BUILD)
OBJDIR := $(OBJDIRBASE)/o/o/o OBJDIR := $(OBJDIRBASE)/o/o/o

16
common/unix.mk Normal file
View File

@ -0,0 +1,16 @@
# Common code needed by most Tracy Unix Makefiles.
# Ensure LIBS is a simply-substituted variable, without changing its value.
LIBS := $(LIBS)
# Tracy does not use TBB directly, but the implementation of parallel algorithms
# in some versions of libstdc++ depends on TBB. When it does, you must
# explicitly link against -ltbb.
#
# Some distributions have pgk-config files for TBB, others don't.
ifeq (0,$(shell pkg-config --libs tbb >/dev/null 2>&1; echo $$?))
LIBS += $(shell pkg-config --libs tbb)
else ifeq (0,$(shell ld -ltbb -o /dev/null 2>/dev/null; echo $$?))
LIBS += -ltbb
endif

View File

@ -1,8 +1,10 @@
include ../../../common/unix.mk
CFLAGS += CFLAGS +=
CXXFLAGS := $(CFLAGS) -std=gnu++17 CXXFLAGS := $(CFLAGS) -std=gnu++17
# DEFINES += -DTRACY_NO_STATISTICS # DEFINES += -DTRACY_NO_STATISTICS
INCLUDES := $(shell pkg-config --cflags capstone) INCLUDES := $(shell pkg-config --cflags capstone)
LIBS := $(shell pkg-config --libs capstone) -lpthread LIBS += $(shell pkg-config --libs capstone) -lpthread
PROJECT := csvexport PROJECT := csvexport
IMAGE := $(PROJECT)-$(BUILD) IMAGE := $(PROJECT)-$(BUILD)
@ -14,11 +16,6 @@ BASE2 := $(shell egrep 'ClCompile.*c"' ../win32/$(PROJECT).vcxproj | sed -e 's/.
SRC := $(filter-out $(FILTER),$(BASE)) SRC := $(filter-out $(FILTER),$(BASE))
SRC2 := $(filter-out $(FILTER),$(BASE2)) SRC2 := $(filter-out $(FILTER),$(BASE2))
TBB := $(shell ld -ltbb -o /dev/null 2>/dev/null; echo $$?)
ifeq ($(TBB),0)
LIBS += -ltbb
endif
OBJDIRBASE := obj/$(BUILD) OBJDIRBASE := obj/$(BUILD)
OBJDIR := $(OBJDIRBASE)/o/o/o OBJDIR := $(OBJDIRBASE)/o/o/o

View File

@ -1,8 +1,10 @@
include ../../../common/unix.mk
CFLAGS += CFLAGS +=
CXXFLAGS := $(CFLAGS) -std=gnu++17 CXXFLAGS := $(CFLAGS) -std=gnu++17
DEFINES += -DTRACY_NO_STATISTICS DEFINES += -DTRACY_NO_STATISTICS
INCLUDES := $(shell pkg-config --cflags capstone) INCLUDES := $(shell pkg-config --cflags capstone)
LIBS := $(shell pkg-config --libs capstone) -lpthread LIBS += $(shell pkg-config --libs capstone) -lpthread
PROJECT := import-chrome PROJECT := import-chrome
IMAGE := $(PROJECT)-$(BUILD) IMAGE := $(PROJECT)-$(BUILD)
@ -14,11 +16,6 @@ BASE2 := $(shell egrep 'ClCompile.*c"' ../win32/$(PROJECT).vcxproj | sed -e 's/.
SRC := $(filter-out $(FILTER),$(BASE)) SRC := $(filter-out $(FILTER),$(BASE))
SRC2 := $(filter-out $(FILTER),$(BASE2)) SRC2 := $(filter-out $(FILTER),$(BASE2))
TBB := $(shell ld -ltbb -o /dev/null 2>/dev/null; echo $$?)
ifeq ($(TBB),0)
LIBS += -ltbb
endif
OBJDIRBASE := obj/$(BUILD) OBJDIRBASE := obj/$(BUILD)
OBJDIR := $(OBJDIRBASE)/o/o/o OBJDIR := $(OBJDIRBASE)/o/o/o

View File

@ -1,8 +1,10 @@
CFLAGS += include ../../../common/unix.mk
CFLAGS +=
CXXFLAGS := $(CFLAGS) -std=c++17 CXXFLAGS := $(CFLAGS) -std=c++17
DEFINES += -DIMGUI_IMPL_OPENGL_LOADER_GL3W DEFINES += -DIMGUI_IMPL_OPENGL_LOADER_GL3W
INCLUDES := $(shell pkg-config --cflags glfw3 freetype2 capstone) -I../../../imgui -I../../libs/gl3w INCLUDES := $(shell pkg-config --cflags glfw3 freetype2 capstone) -I../../../imgui -I../../libs/gl3w
LIBS := $(shell pkg-config --libs glfw3 freetype2 capstone) -lpthread -ldl LIBS += $(shell pkg-config --libs glfw3 freetype2 capstone) -lpthread -ldl
PROJECT := Tracy PROJECT := Tracy
IMAGE := $(PROJECT)-$(BUILD) IMAGE := $(PROJECT)-$(BUILD)
@ -25,17 +27,6 @@ else
LIBS += $(shell pkg-config --libs gtk+-2.0) -lGL LIBS += $(shell pkg-config --libs gtk+-2.0) -lGL
endif endif
# Tracy does not use TBB directly, but the implementation of parallel algorithms
# in some versions of libstdc++ depends on TBB. When it does, you must
# explicitly link against -ltbb.
#
# Some distributions have pgk-config files for TBB, others don't.
ifeq (0,$(shell pkg-config --libs tbb >/dev/null 2>&1; echo $$?))
LIBS += $(shell pkg-config --libs tbb)
else ifeq (0,$(shell ld -ltbb -o /dev/null 2>/dev/null; echo $$?))
LIBS += -ltbb
endif
OBJDIRBASE := obj/$(BUILD) OBJDIRBASE := obj/$(BUILD)
OBJDIR := $(OBJDIRBASE)/o/o/o OBJDIR := $(OBJDIRBASE)/o/o/o

View File

@ -1,8 +1,10 @@
include ../../../common/unix.mk
CFLAGS += CFLAGS +=
CXXFLAGS := $(CFLAGS) -std=gnu++17 CXXFLAGS := $(CFLAGS) -std=gnu++17
DEFINES += -DTRACY_NO_STATISTICS DEFINES += -DTRACY_NO_STATISTICS
INCLUDES := $(shell pkg-config --cflags capstone) INCLUDES := $(shell pkg-config --cflags capstone)
LIBS := $(shell pkg-config --libs capstone) -lpthread LIBS += $(shell pkg-config --libs capstone) -lpthread
PROJECT := update PROJECT := update
IMAGE := $(PROJECT)-$(BUILD) IMAGE := $(PROJECT)-$(BUILD)
@ -14,11 +16,6 @@ BASE2 := $(shell egrep 'ClCompile.*c"' ../win32/$(PROJECT).vcxproj | sed -e 's/.
SRC := $(filter-out $(FILTER),$(BASE)) SRC := $(filter-out $(FILTER),$(BASE))
SRC2 := $(filter-out $(FILTER),$(BASE2)) SRC2 := $(filter-out $(FILTER),$(BASE2))
TBB := $(shell ld -ltbb -o /dev/null 2>/dev/null; echo $$?)
ifeq ($(TBB),0)
LIBS += -ltbb
endif
OBJDIRBASE := obj/$(BUILD) OBJDIRBASE := obj/$(BUILD)
OBJDIR := $(OBJDIRBASE)/o/o/o OBJDIR := $(OBJDIRBASE)/o/o/o