creating my own automake script
Posted: Thu Jan 24, 2008 10:14 am
In school our teachers use Windows and an IDE to write all the little C++ console apps we do. I'm using linux, and no fancy IDE, so I'd like to automate things for myself a bit.
Here is a generic Makefile I have where I only have to edit my SOUCES list and the EXECUTABLE name of my prog.:
I'd like to create a bash-script that will do the following things for me:
1. Copy my Makefile to my current working dir.
2. Either prompt me for my sources list or auto-find them and edit the above Makefile to include them on the SOURCES= line.
and
3. Prompt me for the EXECUTABLE name and likewise, edit the Makefile to
include on the EXECUTABLE= line.
I'm very new to linux, and even newer to shell-scripting. Any ideas, suggestions are welcome!
P.S. I read Solar's Makefile tutorial and well, there wasn't much I understood in there! Don't laugh at my feeble-minded attempt here!
Here is a generic Makefile I have where I only have to edit my SOUCES list and the EXECUTABLE name of my prog.:
Code: Select all
CC=g++
CFLAGS=-c -Wall -Wextra -pedantic
LDFLAGS=
SOURCES=sourceFile.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=progName
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.cpp.o:
$(CC) $(CFLAGS) $< -o $@
clean:
rm -rf *o $(EXECUTABLE)
1. Copy my Makefile to my current working dir.
2. Either prompt me for my sources list or auto-find them and edit the above Makefile to include them on the SOURCES= line.
and
3. Prompt me for the EXECUTABLE name and likewise, edit the Makefile to
include on the EXECUTABLE= line.
I'm very new to linux, and even newer to shell-scripting. Any ideas, suggestions are welcome!
P.S. I read Solar's Makefile tutorial and well, there wasn't much I understood in there! Don't laugh at my feeble-minded attempt here!