-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (27 loc) · 807 Bytes
/
Makefile
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
#~ PowerSetString Makefile ~#
### Definitions Section ###
# Name of the executable to create
EXECUTABLE = PowerSetString
SOURCE_DIR = src
OBJECT_DIR= build
# The command to run for the C++ compiler (here used for C) and linker
CC = gcc
# Basic compiler arguments
CFLAGS = -g -c -Wall
# Basic linker arguments
LDFLAGS = -g
OBJECTS = PowerSetString.o HashMap.o SinglyLinkedList.o WordSort.o Parsing.o
OBJ_FILES = $(addprefix $(OBJECT_DIR)/, $(OBJECTS))
# Create the object_files directory only if it does not exist.
all: setup $(EXECUTABLE)
rebuild: clean all
setup: | $(OBJECT_DIR)
$(OBJECT_DIR):
mkdir -p $@
$(OBJECT_DIR)/%.o: $(SOURCE_DIR)/%.c
$(CC) $(CFLAGS) -o $@ $<
$(EXECUTABLE): $(OBJ_FILES)
$(CC) $(LDFLAGS) -o $@ $^
.PHONY: clean
clean:
rm -rf $(OBJECT_DIR) $(EXECUTABLE)