Created
January 15, 2015 21:26
-
-
Save kube/9909140369c2edae755d to your computer and use it in GitHub Desktop.
Makefile : Sublime Snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
NAME = ${1:program} | |
CXX = g++ | |
CXXFLAGS = ${2:-Wall -Werror -Wextra} | |
SRC = \ | |
${3:main.cpp} | |
OBJ = \$(SRC:.cpp=.o) | |
# Colors | |
NO_COLOR = \x1b[0m | |
OK_COLOR = \x1b[32;01m | |
ERROR_COLOR = \x1b[31;01m | |
WARN_COLOR = \x1b[33;01m | |
SILENT_COLOR = \x1b[30;01m | |
ALIGN_TAB = \e[25G | |
.PHONY: all re space clean fclean | |
all: \$(NAME) | |
%.o: %.cpp | |
@printf "\$(SILENT_COLOR)\$<\$(NO_COLOR)" | |
@\$(CXX) \$(CXXFLAGS) -c \$< -o \$@ | |
@printf "\$(ALIGN_TAB)\$(OK_COLOR)✓\$(NO_COLOR)\n" | |
\$(NAME): \$(OBJ) | |
@printf "\$(OK_COLOR)\$(NAME)\$(NO_COLOR)" | |
@\$(CXX) \$(CXXFLAGS) \$(OBJ) \$(LDFLAGS) -o \$(NAME) | |
@printf "\$(ALIGN_TAB)\$(OK_COLOR)Done ✓\$(NO_COLOR)\n" | |
clean: | |
@rm -f \$(OBJ) | |
@printf "\$(SILENT_COLOR)Removed objects\$(NO_COLOR)\n" | |
fclean: clean | |
@rm -f \$(NAME) | |
@printf "\$(SILENT_COLOR)Removed \$(NAME)\$(NO_COLOR)\n" | |
space: | |
@echo | |
re: fclean space all | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>makefile</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.makefile, text.plain</scope> | |
</snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I try use this snippet on my sublime with gcc. But i have this error:
My makefile script is here:

What are you doing wrong?