-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (59 loc) · 2.35 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#################################################################
# #
# Subscriberfeed build Makefile #
# Author : prantick4u #
# Date : 11/08/2019 #
# #
# #
# #
# #
#################################################################
# Executable name and location
TARGET_DIR := Output
APP := Subscriberfeed.exe
TARGET := $(TARGET_DIR)/$(APP)
# Compiler
CXX := g++
# Build options
CXXFLAGS := -O2 -Wall -fmessage-length=0 -Wno-write-strings -fPIC -fno-common -rdynamic -std=c++14
LDFLAGS := -Bsymbolic-functions
# Includes: Application
INCEXT := hpp
INC_PATHS_APP := $(shell find $(SRCDIR) -name '*.$(INCEXT)' -exec dirname {} \; | uniq| sed /Sources/s/^/-I/)
# Application sources
SRCEXT := cpp
SRCFILES := $(shell find $(SRCDIR) -name '*.$(SRCEXT)')
# Object file list
OBJS = $(SRCFILES:.cpp=.o)
# Library files
LIBS := -lm
# -------- Rules ---------
all: $(TARGET)
rebuild: clean $(TARGET)
clean:
@echo
@echo -------------------------------------------------------------------------------
@echo Cleaning
@echo -------------------------------------------------------------------------------
@rm -fv $(OBJS)
@rm -frv $(TARGET_DIR)
@echo done
@echo
$(TARGET): $(OBJS)
@echo -------------------------------------------------------------------------------
@echo Generating target: $(TARGET)
@echo -------------------------------------------------------------------------------
@mkdir -p $(TARGET_DIR)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBS) $^ -o $@
@echo done
@echo
%.o: %.cpp
@echo -------------------------------------------------------------------------------
@echo Compiling: $<
@echo -------------------------------------------------------------------------------
$(CXX) $(CXXFLAGS) $(INC_PATHS_APP) -c $< -o $@
@echo done
@echo
# -------------------------------------------------------------------------------
# End of File
# -------------------------------------------------------------------------------