-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
59 lines (44 loc) · 1.67 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
#!/usr/bin/make -f
.PHONY: debug release all
CXX ?= g++
CXXFLAGS = -std=c++17 -m32 -pedantic $(OPT_FLAGS) -D_FILE_OFFSET_BITS=64
CXXFLAGS += -Wall -Wextra -Werror -Wnarrowing -Wwrite-strings -Wundef -Wconversion -Wsign-conversion
CXXFLAGS += -Wshadow
CXXFLAGS += -fsanitize=address,undefined
# TODO: enable more options and fix tons of uncovered problems
#CXXFLAGS += -Wcast-qual
# Compiler-specific flags
ifeq ($(findstring clang,$(CXX)), clang)
#CXXFLAGS += -Weverything -Wno-c++98-compat -Wno-zero-as-null-pointer-constant -Wno-old-style-cast
CXXFLAGS += -Wno-invalid-source-encoding -Wno-invalid-utf8 -Wextra-semi-stmt
else
CXXFLAGS += -Wuseless-cast #-fanalyzer
endif
INDEX_SRCS=statfs.cpp dbaseutils.cpp dbase.cpp main.cpp announces.cpp boardtags.cpp speller.cpp security.cpp freedb.cpp profiles.cpp logins.cpp hashindex.cpp error.cpp sendmail.cpp colornick.cpp activitylog.cpp
DBTOOL_SRCS=error.cpp dbaseutils.cpp freedb.cpp profiles.cpp hashindex.cpp profman.cpp
SRCS=$(INDEX_SRCS) $(DBTOOL_SRCS)
INDEX_OBJS=$(INDEX_SRCS:.cpp=.o)
DBTOOL_OBJS=$(DBTOOL_SRCS:.cpp=.o)
debug: OPT_FLAGS=-g3 -ggdb3 -O0
debug: all
release: OPT_FLAGS=-g -O2 -fomit-frame-pointer -flto=auto
release: all
all: index.cgi dbtool
@echo Compiling Done
.SUFFIXES: .cpp .o
.cpp.o:
$(CXX) $(CXXFLAGS) -c $*.cpp
.depend: $(SRCS)
@echo "Creating .depend"
$(CXX) $(CXXFLAGS) -MM -MG $(SRCS) > .depend
ifneq ($(MAKECMDGOALS), clean)
include .depend
endif
index.cgi: $(INDEX_OBJS) .depend
$(CXX) $(CXXFLAGS) -o index.cgi -Wl,-\( $(INDEX_OBJS) -Wl,-\)
dbtool: $(DBTOOL_OBJS) .depend
$(CXX) $(CXXFLAGS) -o dbtool -Wl,-\( $(DBTOOL_OBJS) -Wl,-\)
clean:
@rm -f *.o .depend
@rm -f index.cgi dbtool
@echo Clean complete