-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (33 loc) · 855 Bytes
/
Copy pathMakefile
File metadata and controls
42 lines (33 loc) · 855 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
# Multi-Environment Version ( macOS and Cygwin )
CC = g++
CFLAGS = -g -MMD -MP -std=c++14
LDFLAGS = -lcrypto
LIBS =
MKDIR = mkdir
RM = rm
# Detect environment
ifeq "$(shell uname | awk '$$0 = substr($$0, 1, 6)')" "Darwin"
ENV = mac
else ifeq "$(shell uname | awk '$$0 = substr($$0, 1, 6)')" "CYGWIN"
ENV = cygwin
else
ENV = other
endif
BINDIR = ./bin
TARGET = $(BINDIR)/$(ENV)
INCLUDE = -I./include
SRCDIR = ./src
SOURCES = $(wildcard $(SRCDIR)/*.cpp)
OBJDIR = ./obj/$(ENV)
OBJECTS = $(addprefix $(OBJDIR)/, $(notdir $(SOURCES:.cpp=.o)))
DEPENDS = $(OBJECTS:.o=.d)
$(TARGET): $(OBJECTS) $(LIBS)
$(CC) -o $@ $^ $(LDFLAGS)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(MKDIR) -p $(OBJDIR)
$(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $<
all: clean $(TARGET)
clean:
$(RM) -f $(OBJECTS) $(DEPENDS) $(TARGET)
-include $(DEPENDS)
.PHONY: all clean