Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Makefile that will be given a file with a name following the format A-qu

ID: 3867027 • Letter: W

Question

Write a Makefile that will be given a file with a name following the format A-question.txt. It will create and move our file into a directory called A. When given an argument such as “alan-questions.txt” it creates a directory named alan, and moves alan-questions.txt into alan/questions.txt. Example:

if you have a file in your current directory called a-b-questions.txt and c-d-questions.txt so when the user enter:

$ make Makefile

your directory will have:

a-b folder and inside this folder there is questions.txt

c-d folder and inside this folder there is questions.txt

Explanation / Answer


C_FLAGS := -g -Wall -Wextra
CC := gcc
RM := rm
LINKFLAGS := -lanylibrary
.PHONY: $(TARGET)
.PHONY: clean
build:
@read -p "Enter path:" module;
y = $(subst /, ,$(module))
half1 = $(word 1, $(y))
half2 = $(word 2, $(y))
module_dir=./$$half1;
mkdir -p $$module_dir/build
VPATH:= ./half1/
# Path for .c , .h and .o Files
SRC_PATH := ./src/
# Executable Name
TARGET := half2
# Files to compile
OBJ1 := half2
OBJ := $(patsubst %,$(OBJ1))
# Build .o first
$(OBJ_PATH)%.o: $(SRC_PATH)%($TARGET)
# Build final Binary
$(TARGET): $(OBJ)
@echo [INFO] Creating Binary Executable [$(TARGET)]
# Clean all object files and the binary
clean:   
@echo "[Cleaning]"
@$(RM) -rfv $(OBJ_PATH)*
@$(RM) -rfv $(TARGET)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote