-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (37 loc) · 799 Bytes
/
Makefile
File metadata and controls
48 lines (37 loc) · 799 Bytes
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
# Makefile to build sema
#
CXX = gcc
LIBS = -lpthread
CPP_FLAGS = -g -Wall -Wextra -pedantic -pthread
EXEC = sema
SRC = sema.c
EXEC_INSTALL_DIR = /usr/bin
DOC_INSTALL_DIR = /usr/share/doc/sema
OBJS = $(SRC:.c=.o)
DOC_OBJS = AUTHORS INSTALL LICENSE README
%.o: %.c
$(CXX) $(CPP_FLAGS) -c $< -o $@
.PHONY: all
all: $(EXEC)
$(EXEC): $(OBJS)
$(CXX) -o $(EXEC) $(LIBS) -pthread $(OBJS)
install: all
install $(EXEC) $(EXEC_INSTALL_DIR)
install -d $(DOC_INSTALL_DIR)
for f in $(DOC_OBJS); \
do \
install $${f} $(DOC_INSTALL_DIR); \
done
test: all
$(EXEC) -c sema-test;\
$(EXEC) -r sema-test;\
$(EXEC) -w sema-test;\
$(EXEC) -d sema-test;\
if [ $$? -ne 0 ];\
then echo "Unit test failed";\
else \
echo "All test(s) passed";\
fi
.PHONY: clean
clean:
rm -f $(OBJS) $(EXEC)