-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (37 loc) · 1.32 KB
/
Makefile
File metadata and controls
46 lines (37 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# --------------------------------------------------------
# Makefile - versitility to use again for C or C++ files
# 'make' builds executable targets marked from 'all:'
# 'make mysort' creates executable object for sort algos
# 'make counter' creates executable object for counter
# 'make numGen' creates random number generator object
# 'make clean' removes all .o and executable files
# --------------------------------------------------------
# the compiler: gcc for C program, define as g++ for C++
CC = g++
# compiler flags:
# -g adds debugging information to the executable file (dSYM files)
# -Wall turns on most, but not all, compiler warnings
# -w inhibits all warning messages
CFLAGS = -w
# GCC standard support for different C++ dialects (98, 11, 14, 17, or 2a)
STD = -std=c++11
# variables
SORTPRGM=mysort
SORTSRC=mysort.cpp
CNTRPRGM=counter
CNTRSRC=counter.cpp
NUMGENPRGM=numGen
NUMGENSRC=randomNumberGen.cpp
all: clean $(CNTRPRGM) $(SORTPRGM)
# counter
$(CNTRPRGM): $(CNTRSRC)
$(CC) $(STD) $(CFLAGS) $(CNTRSRC) -o $(CNTRPRGM) -lpthread
# mysort
$(SORTPRGM): $(SORTSRC)
$(CC) $(STD) $(CFLAGS) $(SORTSRC) -o $(SORTPRGM) -lpthread
# random numbers generation
$(NUMGENPRGM): $(NUMGENSRC)
$(CC) $(CFLAGS) $(NUMGENSRC) -o $(NUMGENPRGM)
# clean all objects
clean:
rm -rf $(SORTPRGM) $(CNTRPRGM) $(NUMGENPRGM)