Commit 9d2b6c97 authored by hasan  khaddour's avatar hasan khaddour

Update MAKEFILE , Fix building issue

parent 15f0cec1
# Compiler and flags # Compiler and flags
CC = g++ CC = gcc
CFLAGS = -fopenmp -O2 CFLAGS = -fopenmp -O2
PROF_FLAGS = -pg PROF_FLAGS = -pg
# Source file
SRC = $(Pr)
# Targets # Targets
TARGET_INTEGRAL = integral TARGET_INTEGRAL = integral
TARGET_MANDELBROT = mandelbrot TARGET_MANDELBROT = mandelbrot
...@@ -12,18 +15,18 @@ all: $(TARGET_INTEGRAL) $(TARGET_MANDELBROT) ...@@ -12,18 +15,18 @@ all: $(TARGET_INTEGRAL) $(TARGET_MANDELBROT)
# Conditional build target # Conditional build target
build: build:
$(CC) $(CFLAGS) -o $($(Pr)) $(Pr).c $(CC) $(CFLAGS) -o $(SRC) $(Pr).c
# Conditional run target # Conditional run target
run: run:
./$($(Pr)) ./$(SRC)
# Profile the specified program # Profile the specified program
profile: profile:
$(CC) $(CFLAGS) $(PROF_FLAGS) -o $($(Pr)) $(Pr).c $(CC) $(CFLAGS) $(PROF_FLAGS) -o $(Pr) $(SRC).c
./$($(Pr)) ./$(SRC)
gprof $($(Pr)) gmon.out > $(Pr)_profile.txt gprof $(SRC).exe gmon.out > $(Pr)_profile.txt
cat $(Pr)_profile.txt type $(Pr)_profile.txt
# Build each program individually # Build each program individually
$(TARGET_INTEGRAL): integral.c $(TARGET_INTEGRAL): integral.c
...@@ -35,3 +38,4 @@ $(TARGET_MANDELBROT): mandelbrot.cpp ...@@ -35,3 +38,4 @@ $(TARGET_MANDELBROT): mandelbrot.cpp
# Clean command # Clean command
clean: clean:
rm -f $(TARGET_INTEGRAL) $(TARGET_MANDELBROT) gmon.out integral_profile.txt mandelbrot_profile.txt rm -f $(TARGET_INTEGRAL) $(TARGET_MANDELBROT) gmon.out integral_profile.txt mandelbrot_profile.txt
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment