-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (46 loc) · 1.36 KB
/
Makefile
File metadata and controls
58 lines (46 loc) · 1.36 KB
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
#
# Makefile for CPP
#
# Compiler and compiler options:
DEBUG = false
CXX = g++
CC = g++
CXXFLAGS = -pipe -O2 -Wall -W -ansi -pedantic-errors
CXXFLAGS += -std=c++11 -Wmissing-braces -Wparentheses -Wold-style-cast
ROOTDIR = ./
BINDIR = $(ROOTDIR)bin/
PROGRAM = src/newsserver_hdd src/newsserver_ram src/newsclient
SRCS = $(wildcard *.cc)
OBJS = $(SRCS:.cc=.o)
AGP = $(SRCS:.cc=.d)
#Debug check
ifeq ($(DEBUG), true)
CXXFLAGS += -ggdb
LDFLAGS += -ggdb
else
CXXFLAGS += -O2
endif
#Default target 'all', make everything
all: $(PROGRAM)
mkdir -p $(BINDIR)
mv src/newsserver_hdd $(BINDIR)
mv src/newsserver_ram $(BINDIR)
mv src/newsclient $(BINDIR)
.PHONY: all clean cleaner cleanest
# Linking
src/newsserver_hdd: src/newsserver_hdd.o src/server.o src/connection.o src/servercoder.o src/cmdtranslate.o src/hddstorage.o src/article.o src/newsgroup.o
src/newsserver_ram: src/newsserver_ram.o src/server.o src/connection.o src/servercoder.o src/cmdtranslate.o src/ramstorage.o src/article.o src/newsgroup.o
src/newsclient: src/newsclient.o src/connection.o src/clientcoder.o
clean:
$(RM) $(OBJS)
cleaner: clean
$(RM) $(AGP)
cleanest: cleaner
$(RM) $(PROGRAM).exe
$(RM) $(PROGRAM)
%.d: %.cc
@set -e; rm -f $@; \
$(CXX) -M $(CXXFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
include $(AGP)