I am trying to build a C++ project in Sublime Text 3 on Linux. Normally I just swap to the terminal and run make run
and it runs. However, I'm trying to streamline the process by running directly in Sublime. However, pressing Ctrl+Shift+B brings up only two options: Make and Make clean. Both of which will do the command according to my Makefile for the project. However, there is no Make run, so I can't directly run the project by pressing Ctrl+B. I hope someone can provide some insight into this!
Here is my Makefile:
BINARY := build/project
SRCS := $(shell find . -iname "*.cpp")
OBJS := $(addprefix build/,$(SRCS:.cpp=.o))
NEEDED_LIBS :=
CXX := g++ -flto
LD := $(CXX) $(addprefix libs/,$(NEEDED_LIBS))
override CXXFLAGS += -std=c++11
override LDFLAGS += $(CXXFLAGS)
all:$(BINARY)
$(BINARY):$(OBJS) $(addprefix libs/,$(NEEDED_LIBS))
$(LD) $(LDFLAGS) -o $@ $^
build/%.o:%.cpp
$(CXX) -O2 -c $(CXXFLAGS) $< -o $@
run:$(BINARY)
@$(BINARY)
clean:
rm -rf build/*