-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (37 loc) · 816 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
44
45
46
47
48
49
50
51
# OS specific part
ifeq ($(OS),Windows_NT)
RM = del /S
RMALLO = del /S *.o
RMDIR = -RMDIR /S /Q
MKDIR = -mkdir
ERRIGNORE = 2>NUL || true
SEP=\\
else
RM = rm -f
RMALLO = find . -type f -name '*.o' -print -delete
RMDIR = rm -rf
MKDIR = mkdir -p
ERRIGNORE = 2>/dev/null
SEP=/
endif
PSEP = $(strip $(SEP))
# Define project directory
PROJDIR := $(realpath $(CURDIR)$(PSEP)..)
# Define src directory to compile main file
SOURCEDIR := $(subst /, $(PSEP), $(PROJDIR)$(PSEP)src$(PSEP))
OUT := calculator.exe
CC = gcc
FLAGS = -c -Wall
LFLAGS =
INCLUDE = -I lib
.PHONY: all rebuild clean
all: libs main.o
$(CC) -o $(OUT) src\main.o lib\functions.o
main.o: src\main.c
$(CC) $(FLAGS) $(INCLUDE) -o src\main.o src\main.c
libs:
cd lib && $(MAKE)
rebuild: clean all
clean:
$(RMALLO)
$(RM) $(OUT)