Help with Simple Multi-Level Makefile (Extremely New at Makefile)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code provided compiles and do not need to be checked so I won't put them here. I'm just having trouble with the makefiles themselves.
=====
The directory tree you will be working with has the following root:
makefile_assignment/: <== You are here.
The directory "makefile_assignment/" contains the following four
subdirectories:
bin/ c/ cpp/ java/
Except for "makefile_assignment/bin/", each subdirectory above
represents a subtask. Be aware that there are further subtasks in
"C and SPARC assembly subtask" and "C++ and archiving subtask"! These subtasks
will be described before the rest of "Makefile task", because "Makefile task"
depends on all of them as subtasks.
=====
BEGIN: C subtask
=====
The directory "makefile_assignment/c/" contains a C header file, "functions.h",
and a single C file, "main.c", in addition to one subdirectory:
cfiles/
=====
BEGIN: C dependencies subtask
=====
The directory "makefile_assignment/c/cfiles/" contains the following C source
files:
For this subtask ("C subtask"), you must write a Makefile to do the following:
default target:
1. Compile all source files into object code files.
2. Copy all object code files into the parent directory.
clean target:
1. Delete all object code files.
2. Delete all core dumps.
new target:
1. "make" the "clean" target.
2. "make" the "default" target.
=====
END: C dependencies subtask
=====
For this subtask ("C subtask"), you must write a Makefile to
do the following:
default target:
1. "make" the "cfiles/" directory contents.
2. Compile the source file in this directory, "main.c", into an object
code file.
3. Link all object code files into a executable named "c.exe".
Remember that the "C dependencies subtask" creates object files on which
"main.c" depends.
4. Copy "c.exe" into the directory "makefile_assignment/bin/".
clean target:
1. Clean the "cfiles/" directory.
2. Delete all object code files in this directory.
3. Delete all core dumps in this directory.
new target:
1. "make" the "clean" target.
2. "make" the "default" target.
=====
END: C subtask
=====
=====
BEGIN: C++ and archiving subtask
=====
The directory "makefile_assignment/cpp/" contains a C++ header file, "main.h",
and a single C++ file, "main.cpp", in addition to a lone subdirectory:
lib/
=====
BEGIN: Archiving subtask
=====
The directory "makefile_assignment/cpp/lib/" contains the following C++ source
and header files:
For this subtask ("Archiving subtask"), you must write a Makefile to do the
following:
default target:
1. Compile all source files into object code files.
2. Using the archiver "ar", archive the object code files into an
archive named "libFunctions.a".
clean target:
1. Delete the archive "libFunctions.a".
2. Delete all object code files.
3. Delete all core dumps.
new target:
1. "make" the "clean" target.
2. "make" the "default" target.
=====
END: Archiving subtask
=====
For this subtask ("C++ subtask"), you must write a Makefile to do
the following:
default target:
1. "make" the "lib/" directory contents.
2. Compile the source file in this directory, "main.cpp", into an
object code file.
3. Link all object code files into a executable named "cpp.exe".
Remember that the "Archiving subtask" creates an archive on which
"main.cpp" depends.
4. Copy "cpp.exe" into the directory "makefile_assignment/bin/".
clean target:
1. Clean the "lib" directory.
2. Delete the object code files in this directory.
3. Delete all core dumps in this directory.
new target:
1. "make" the "clean" target.
2. "make" the "default" target.
=====
END: C++ and archiving subtask
=====
=====
BEGIN: Java subtask
=====
The directory "makefile_assignment/java/" contains a single Java source file,
"Main.java", and no subdirectories.
For this subtask ("Java subtask"), you must write a Makefile to do the
following:
default target:
1. Compile the Java source file in this directory, "Main.java", into a
Java class file.
2. Copy "Main.class" into the directory "makefile_assignment/bin/".
clean target:
1. Delete the Java class files in this directory.
2. Delete all core dumps in this directory.
new target:
1. "make" the "clean" target.
2. "make" the "default" target.
=====
END: Java subtask
=====
This is the rest of "Makefile task", which has you producing yet another
Makefile to tie all the subtasks together. This Makefile must be capable of
carrying out the following:
default target:
1. "make" the targets "c", "cpp", and "java".
c target:
1. "make" the contents of the directory "makefile_assignment/c/".
cpp target:
1. "make" the contents of the directory "makefile_assignment/cpp/".
java target:
1. "make" the contents of the directory "makefile_assignment/java/".
clean target:
1. Clean the "c/" directory.
2. Clean the "cpp/" directory.
3. Clean the "java/" directory.
4. Delete all executables in the "bin/" directory.
5. Delete all core dumps in the "bin/" directory.
new target:
1. "make" the "clean" target.
2. "make" the "default" target.
=====
END: Makefile task
=====
2. Relevant commands, code, scripts, algorithms:
Won't be providing the .c, .cpp, .java files as they all compile just fine.
3. The attempts at a solution (include all code and scripts):
makefile for /cfiles
makefile for /c
makefile for /lib
makefile for /cpp
makefile for /java
makefile for /makefile_assignment 4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
University of San Diego, California (UCSD)
La Jolla, San Diego
USA
Professor Gary Gillespie
CSE80
ieng6.ucsd.edu/~cs80w/UCSD_CSE_80_-_WI_2011/Welcome.html
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
I am creating a make file, but i keep getting an error when i try to run it with the following code:
make foo . make $(EXE)
i get
EXE: command not found
make: `foo' is up to date.
make: Nothing to be done for `.'.
make: *** No rule to make target `make'. Stop.
Here is my... (6 Replies)
I create figures using Gnuplot, but I use terminal epslatex, which produces a .tex file as output. I then latex this .tex file which creates are .dvi file, which I then convert to .ps and finally to an .eps file. Anyway here's what I'm doing in steps
gnuplot plot.gplt (this writes out... (2 Replies)
I have 2 libraries in 2 different directories that I build with Makefiles.
library B depends on library A. If I modify a .cpp file in library A and run lib B's Makefile can I have B's makefile to automatically rebuild library A?
I am now rebuilding A, followed by B... but I'd like B to... (0 Replies)
hello,
I have a firts makefile who call others makefile. for this i use:
$ make -f linux.mak
and output his:
$ make -f linux.mak all
make -C DerelictAL all PLATFORM=linux
make: Entering directory `/home/builder/rpmbuild/SOURCES/derelict2-20100407/DerelictAL'
make: Nothing to be done for... (2 Replies)
Hi all,
I'm new to make files . I'm writing a make file to compile and create .so files. i've 20 .cpp files. I want to compile one file at a time and then i've to create 1 .so for each file that i compiled.
for eg:
list.mk is having all the 20 .spp files.
name = a.cpp
name =+... (2 Replies)
Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error:
make: module: command not found
Why is this? Is there any way to run this command in a Makefile?
NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Hi all,
I have 4 '.cpp' files and 1 header files:
Tools.cpp
Code1.cpp
Code2.cpp
Code3.cpp
and Tools.hh
Now all Code1.cpp, Code2.cpp, Code3.cpp
use functions stored in Tools.cpp.
Currently, what I do to compile all of them is using
this simple shell script: (1 Reply)
Hi
I tried many times and I dont know what the he... is going on.
Problem:
I hava in /home/marcin/c1_menu/
this file:
menu_item_data.c
I want to compile this file.
so I tried something like this
CC=gcc
LIBS=-lmenu -lncurses
RM=rm
BINS=menu_item_data
%: %.o
${CC} -o $@... (1 Reply)
Hello
I have compilation directory structure the top level Makefile is the one that contains all the sub directories
I want to set in this Makefile env variable say : setenv OPTIMIZATION_LEVEL "1"
and when all the sub directories done compiling it will set this variable to different lavel... (0 Replies)
i'd like to execute a particular command if i'm running gcc version 3.2 for instance.
my approach is as follows:
GCC_VERSION := `gcc --version | head -1`
suppose the result of `gcc --version | head -1` was
gcc 3.2
then i'd like to perform the following:
ifeq ($(GCC_VERSION), "gcc 3.2")... (1 Reply)