Created
May 14, 2020 13:15
-
-
Save slendidev/fde51b9415fad060b185855e04ab7bf2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/bin/env bash | |
| for var in "$@" | |
| do | |
| printf "Generating project $var " | |
| # Generate project | |
| if [[ -d $var ]] | |
| then | |
| printf "[\e[0;49;91mFAILED\e[m]\n" | |
| echo "E: $var exists on your filesystem." | |
| continue | |
| else | |
| mkdir -p $var/src $var/include | |
| echo -e "appname := $var | |
| CXX := g++ | |
| CXXFLAGS := -Wall -g -Iinclude | |
| srcfiles := \$(shell find src -maxdepth 1 -name "*.cpp") | |
| objects := \$(patsubst %.cpp, %.o, \$(srcfiles)) | |
| all: \$(appname) | |
| \$(appname): \$(objects) | |
| \t\$(CXX) \$(CXXFLAGS) \$(LDFLAGS) -o \$(appname) \$(objects) \$(LDLIBS) | |
| depend: .depend | |
| .depend: \$(srcfiles) | |
| \trm -f ./.depend | |
| \t\$(CXX) \$(CXXFLAGS) -MM $^>>./.depend; | |
| clean: | |
| \trm -f \$(objects) | |
| dist-clean: clean | |
| \trm -f *~ .depend | |
| include .depend" >> $var/Makefile; | |
| echo -e "#include <iostream> | |
| int main(int argc, char** argv) { | |
| std::cout << \"Hello World!\\\\n\"; | |
| return 0; | |
| }\n" >> $var/src/main.cpp; | |
| fi | |
| printf "[ \e[0;49;32mDONE\e[m ]\n" | |
| done |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| for var in "$@" | |
| do | |
| printf "Generating $var.hpp " | |
| if [[ -f $var ]] | |
| then | |
| printf "[\e[0;49;91mFAILED\e[m]\n" | |
| echo "E: $var exists on your filesystem." | |
| continue | |
| else | |
| echo -e "#ifndef _${var^^}_HPP | |
| #define _${var^^}_HPP | |
| // Your code goes here | |
| #endif // _${var^^}_HPP\n" >> $var.hpp | |
| fi | |
| printf "[ \e[0;49;32mDONE\e[m ]\n" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment