Question: # specify the object files . . . OBJ = main.o functions.o # specify the compiler CC = gcc # this is the cross platform

# specify the object files ...
OBJ = main.o functions.o
# specify the compiler
CC = gcc # this is the cross platform standard C compiler
CXX = g++ # this is the GNU C++ compiler
#CXX = CC # Solaris C++ compiler
# specify the compiler options
CFLAGS =-g
# specify the target C files
TARGET_SRC = main.c functions.c
# specify variables
EXE_NAME = demo
# leads comments in a line
# Build all: default target
all: $(EXE_NAME)
# Separate compilation to build object files
main.o: main.c functions.h
$(CC)-c $(CFLAGS) main.c
function.o: functions.c functions.h
$(CC)-c $(CFLAGS) functions.c
# linking
#demo is a target which depends upon main.o and functions.o
#"gcc main.o functions.o -o demo" is the command to produce the executable file
#You need to use a TAB before gcc
$(EXE_NAME): $(OBJ)
$(CC) $(OBJ)-o $(EXE_NAME)
# Testing
check: all
./$(EXE_NAME)
# Debugging with gdb
g: all
gdb ./$(EXE_NAME)
# Valgrind
valgrind:
valgrind --leak-check=full --show-leak-kinds=all ./$(EXE_NAME)
# Clean up all build targets so that one may get a clean build
clean:
rm -f *.o $(EXE_NAME)*core*
fix the valgrind issue in this make file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!