-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
42 lines (35 loc) · 1.01 KB
/
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
# path #
LINUX_INCLUDE_PATH = /usr/local/include
# name #
LIB_NAME = c_vector
# src #
SRC_PATH = src
HEADER_EXTENSION = h
SRC = $(shell find $(SRC_PATH) -name '*.$(HEADER_EXTENSION)')
# uname #
UNAME = $(shell uname)
.PHONY: default_target
default_target:
@echo "C_Vector Options:"
@printf "\tmake install \n\t\t Install c_vector headers on a Linux machine [Requires Root]\n"
@printf "\tmake clean \n\t\t Remove c_vector headers on a Linux machine [Requires Root]\n"
@printf "\tmake test \\n\t\t Run the test cases\n"
.PHONY: install
install:
@if [ "$(UNAME)" == "Linux" ]; then \
echo "Installing $(LIB_NAME)"; \
sudo mkdir -p $(LINUX_INCLUDE_PATH)/$(LIB_NAME); \
echo "Copying $(SRC) -> $(LINUX_INCLUDE_PATH)/$(LIB_NAME)"; \
sudo cp $(SRC) $(LINUX_INCLUDE_PATH)/$(LIB_NAME)/.; \
fi
.PHONY: clean
clean:
@if [ "$(UNAME)" == "Linux" ]; then \
echo "Removing $(LIB_NAME)"; \
sudo $(RM) -r $(LINUX_INCLUDE_PATH)/$(LIB_NAME); \
fi
.PHONY: test
test:
@clang ./tests/test.c -lcmocka -o test
@./test
@$(RM) test