Skip to content

Instantly share code, notes, and snippets.

@timani
Created April 1, 2017 18:53
Show Gist options
  • Save timani/2c7a63d5fc20753e8299dff35e14d9e2 to your computer and use it in GitHub Desktop.
Save timani/2c7a63d5fc20753e8299dff35e14d9e2 to your computer and use it in GitHub Desktop.
# Makefile
# Author: Pivotal Support
# Modify the includes, sources, headers, executable and
# other flags accordingly!
INCLUDES = -I ./ -I/usr/local/include
LIBS = -L/usr/lib/ -lm
CC = g++
DEBUG = -g
LFLAGS = -Wall $(DEBUG)
CFLAGS = -Wall -c
SOURCES = File1.cpp \
File2.cpp \
File3.cpp
HEADERS = File1.h \
File2.h
PLAYBOOK_DIR = playbooks
COMPONENT = foobar
NEW_COMPONENT_DIR = $(PLAYBOOK_DIR)/$(COMPONENT)
TEMPLATE_DIR = $(PLAYBOOK_DIR)/Template
RUNBOOK_DIR = $(TEMPLATE_DIR)/runbooks
RUNBOOK_TEMPLATE = $(RUNBOOK_DIR)/runbook-1.md
all: MyExecutable
playbook: bar component
build:
@read -p "Enter Module Name:" module; \
module_dir=./modules/$$module; \
mkdir -p $$module_dir/build
bar:
@echo "** Step 1/4: Checking to see if $(TEMPLATE_DIR) exists"
@ if [ -d $(TEMPLATE_DIR) ]; then \
echo "Hooray... I have a $(TEMPLATE_DIR) file!"; \
ls -la $(PLAYBOOK_DIR); \
else \
echo "Oh no! There was no $(TEMPLATE_DIR) found"; \
fi
component:
# $(CC) $(CFLAGS) $(INCLUDES) $< -o $@
@echo "\n ** Step 2/4: Creating the component playbook $(PLAYBOOK_DIR)/$(COMPONENT)"
mkdir -p $(PLAYBOOK_DIR)/$(COMPONENT)
cp -r $(TEMPLATE_DIR) $(NEW_COMPONENT_DIR)
@echo "New playbook succesfully created - $(PLAYBOOK_DIR)/$(COMPONENT)"
ls -la $(PLAYBOOK_DIR)/$(COMPONENT)
runbook:
@echo "\n ** Create a runbook"
# Should be select component from an ls -f playbooks for directories
@read -p "Enter the component:" component; \
export COMPONENT=$$component;
@read -p "Enter the title of the runbook:" runbook; \
export RUNBOOK=$$runbook; \
echo "\n ** Creating a new runbook - $$runbook"; \
cp $(RUNBOOK_TEMPLATE) $(PLAYBOOK_DIR)/$(COMPONENT)/runbooks/$$runbook.md; \
echo $(RUNBOOK_TEMPLATE) $(PLAYBOOK_DIR)/$(COMPONENT)/runbooks/$(RUNBOOK); \
ls -la $(PLAYBOOK_DIR)/$(COMPONENT)/runbooks/$$runbook.md
tar:
tar -czf $(EXE).tar.gz $(SOURCES) $(HEADERS) Makefile
clean:
rm -f $(OBJ)
rm -f $(EXE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment