-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (50 loc) · 1.78 KB
/
Copy pathMakefile
File metadata and controls
60 lines (50 loc) · 1.78 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
##############################################
# Makefile for cfc Utility
# Author: Cole Vikupitz
##############################################
##### Uncomment this to suppress make from echoing the commands
#.SILENT:
##### Collection of phony Makefile targets
.PHONY: dist clean mostlyclean help
##### Project metadata
NAME=cfc
VERSION=v1
DIST=$(NAME)-$(VERSION)
##### Directories for header, source, and test files
INCLUDE=./include
SRC=./src
##### Macros used for compilation & linking stages
CC=gcc
CFLAGS=-W -Wall -Wextra -g
IFLAGS=-I$(INCLUDE)
LIBS=-lpthread
COMPILE=$(CC) $(CFLAGS) $(IFLAGS) -c -o $@ $^
LINK=$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
##### List of object files to create for executable
OBJS=$(SRC)/arg_parser.o $(SRC)/crawler.o $(SRC)/driver.o $(SRC)/file_utils.o $(SRC)/iterator.o $(SRC)/queue.o \
$(SRC)/regex_engine.o $(SRC)/treeset.o $(SRC)/ts_iterator.o $(SRC)/ts_treeset.o $(SRC)/work_queue.o
##### Builds the executable
$(NAME): $(OBJS)
$(LINK)
##### Target for compiling individual source files
$(SRC)/%.o: $(SRC)/%.c
$(COMPILE)
##### Creates a distribution tarball of the project
dist:
mkdir $(DIST)/
rsync -avz --exclude=$(DIST) * $(DIST)/
tar -czvf $(DIST).tgz $(DIST)/
rm -fr $(DIST)/
##### Targets for cleaning up the project
clean:
rm -f $(OBJS) $(DIST).tgz $(NAME)
mostlyclean:
rm -f $(OBJS) $(DIST).tgz
##### Target for displaying the usage message
help:
@echo "Possible targets for this Makefile are the following:"
@echo " cfc (default) : Compiles and builds the file crawler executable."
@echo " dist : Creates an archive (.tgz) of the complete repository."
@echo " clean : Cleans all project files."
@echo " mostlyclean : Cleans all project files except for the built libraries."
@echo " help : Displays this help message."