From 5ae738b0cfc690cf551da0d8bfe9147c5ea29c78 Mon Sep 17 00:00:00 2001 From: SuperNovaa41 Date: Mon, 24 Feb 2025 11:21:01 -0500 Subject: [PATCH] creates a whole suite --- install.sh | 9 +++++++++ run.sh | 24 ++++++++++++++++++++++-- templates/c/Makefile | 24 ++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100755 install.sh create mode 100644 templates/c/Makefile diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..1e84596 --- /dev/null +++ b/install.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +mkdir -p $HOME/.config/templates/ +cp -r templates/* $HOME/.config/templates + +chmod +x run.sh + +sudo cp run.sh /usr/local/bin/tempc + diff --git a/run.sh b/run.sh index 1ad1c1f..06a6647 100755 --- a/run.sh +++ b/run.sh @@ -1,9 +1,29 @@ #!/bin/bash -git init +list_templates() { + for dir in $HOME/.config/templates/*/ + do + dir=${dir%*/} + echo "${dir##*/}" + done +} + +if [[ -z "$1" ]]; then + echo "No template provided." + echo "Available templates:" + list_templates + exit +fi if [ ! -d "$HOME/.config/templates/$1" ]; then echo "Template doesn't exist!" + echo "Available templates:" + list_templates + exit else - cp -r ~/.config/templates/$1/* . + cp -r $HOME/.config/templates/$1/* . + git init fi + + + diff --git a/templates/c/Makefile b/templates/c/Makefile new file mode 100644 index 0000000..11a00a3 --- /dev/null +++ b/templates/c/Makefile @@ -0,0 +1,24 @@ +CC=gcc +CFLAGS= -c -g -Wall + +#LDLIBS = # -lcurl -lssl ... + +#TARGET := + +BUILD_DIR := ./build +SRC_DIRS := ./src + +SRCS := $(shell find $(SRC_DIRS) -name '*.c') + +OBJS := $(SRCS:%=$(BUILD_DIR)/%.o) + +$(BUILD_DIR)/$(TARGET): $(OBJS) + $(CC) $(OBJS) -o $@ $(LDLIBS) + +$(BUILD_DIR)/%.c.o: %.c + mkdir -p $(dir $@) + $(CC) $(CFLAGS) -c $< -o $@ + +.PHONY: clean +clean: + rm -rf $(BUILD_DIR)