Debian Codegraph @

Makefile

raw symbols ◀ ▶ SCIP
2 Debian patches touch this file
•1 ifeq ("$(wildcard .git)", "")
2 RAILCONTROL_VERSION=$(shell cat VERSION | sed s/v//)
3 GIT_HASH=$(shell cat VERSION_GIT_HASH)
4 GIT_TIMESTAMP=$(shell cat VERSION_GIT_TIMESTAMP)
5 GIT_DIRTY=0
6 else
7 .PHONY: Version.cpp
8 RAILCONTROL_VERSION=$(shell git describe --tags --abbrev=0 | sed s/v//)
9 GIT_HASH=$(shell git log -1 --format=%H)
10 GIT_TIMESTAMP=$(shell git log -1 --format=%at)
11 GIT_DIRTY=$(shell git status -s | wc -l)
12 endif
13
14 CFLAGSSQLITE=-g -O2 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DHAVE_USLEEP
15 CFLAGSZLIB=-g -O2 -Wno-implicit-function-declaration -Wno-\#warnings -Wno-deprecated -Wno-deprecated-non-prototype
16 CXXFLAGS=-I. -g -O2 -Wall -Wextra -pedantic -Werror -Wno-missing-braces -std=c++11 -D_GNU_SOURCE
17 CXXFLAGSAMALGAMATION=-I. -g -O2 -Wall -Wextra -pedantic -Werror -Wno-missing-braces -std=c++11
18 LDFLAGS=-g
19 LIBS=-lpthread -ldl
20 LIBSAMALGAMATION=-lpthread -ldl
21
22 ifeq ($(OS),Windows_NT)
23 LDFLAGS+= -static
24 endif
25
26 TMPDIR=/tmp/RailControl
27 TMPDIRCYGWIN=/RailControl
28
29 CXXOBJ= $(patsubst %.cpp,%.o,$(sort Version.cpp $(wildcard *.cpp)) $(wildcard Server/Web/*.cpp Server/CS2/*.cpp Server/Z21/*.cpp DataModel/*.cpp Hardware/*.cpp Hardware/Protocols/*.cpp Logger/*.cpp Network/*.cpp Storage/*.cpp Utils/*.cpp))
•30
31 ifdef USE_SYSTEM_LIBRARIES
32 LIBS+= -lsqlite3 -lz
•33 OBJ=$(CXXOBJ)
34 else
35 CXXFLAGS+= -IStorage/sqlite -IHardware/zlib
36 COBJ= $(patsubst %.c,%.o,$(wildcard Hardware/zlib/*.c))
37 OBJ=Storage/sqlite/sqlite3.o $(CXXOBJ) $(COBJ)
•38 endif
39
40 SOURCE_DATE_EPOCH?=$(shell date +%s)
41
42 all: $(OBJ)
43 $(CXX) $(LDFLAGS) $(OBJ) -o railcontrol $(LIBS)
44
45 strip: all
46 strip railcontrol
47
48 dist: all
49 strip railcontrol
50 mkdir $(TMPDIR)
51 cp -r \
52 html \
53 railcontrol.conf.dist \
54 railcontrol \
55 $(TMPDIR)
56 ( cd $(TMPDIR)/.. && tar cvJf railcontrol.`date +"%Y%m%d"`.tar.xz RailControl/* )
57 rm -r $(TMPDIR)
58
59 dist-cygwin: all
60 strip railcontrol.exe
61 mkdir $(TMPDIRCYGWIN)
62 cp -r \
63 /cygdrive/c/Windows/SYSTEM32/ntdll.dll \
64 /cygdrive/c/Windows/system32/KERNELBASE.dll \
65 /cygdrive/c/Windows/system32/kernel32.dll \
66 /usr/bin/cygwin1.dll \
67 html \
68 railcontrol.conf.dist \
69 railcontrol.exe \
70 $(TMPDIRCYGWIN)
71 zip -9 railcontrol.windows.`date +"%Y%m%d"`.zip $(TMPDIRCYGWIN)/* $(TMPDIRCYGWIN)/html/*
72 rm -r $(TMPDIRCYGWIN)
73
74 amalgamation.cpp:
75 ./amalgamation.bash
76
77 amalgamation: amalgamation.o Version.cpp Storage/sqlite/sqlite3.o $(COBJ)
78 $(CXX) -g amalgamation.o Storage/sqlite/sqlite3.o Hardware/zlib/*.o -o railcontrol $(LIBSAMALGAMATION)
79 strip railcontrol
80 rm -f amalgamation.o
81 rm -f amalgamation.cpp
82
83 sqlite-shell:
84 make -C Storage/sqlite
85
86 Version.o: Version.cpp Version.h
87 $(CXX) $(CXXFLAGS) -c -o $@ $<
88
89 Hardware/zlib/%.o: Hardware/zlib/%.c Hardware/zlib/*.h
90 $(CC) $(CFLAGSZLIB) -c -o $@ $<
91
92 Storage/sqlite/sqlite3.o: Storage/sqlite/sqlite3.c Storage/sqlite/sqlite3.h
93 $(CC) $(CFLAGSSQLITE) -c -o $@ $<
94
95 %.o: %.cpp *.h DataModel/*.h Hardware/*.h Hardware/Protocols/*.h Logger/*.h Network/*.h Storage/*.h Utils/*.h Server/Web/*.h Server/CS2/*.h Server/Z21/*.h
96 $(CXX) $(CXXFLAGS) -c -o $@ $<
97
98 .PHONY: clean
99 clean:
100 rm -f *.o DataModel/*.o Hardware/*.o Hardware/Protocols/*.o Hardware/zlib/*.o Logger/*.o Network/*.o Storage/*.o Storage/sqlite/*.o Utils/*.o Server/Web/*.o Server/CS2/*.o Server/Z21/*.o
101 rm -f railcontrol
102
103 clean-sqlite-shell:
104 make -C Storage/sqlite clean
105
106 test:
107 make -C test
108
109 tools:
110 make -C tools
111
•112 Version.cpp: Version.cpp.in VERSION VERSION_GIT_HASH VERSION_GIT_TIMESTAMP
113 sed -e s/@COMPILE_TIMESTAMP@/$(SOURCE_DATE_EPOCH)/ \
114 -e s/@GIT_HASH@/$(GIT_HASH)/ \
115 -e s/@GIT_TIMESTAMP@/$(GIT_TIMESTAMP)/ \
116 -e s/@GIT_DIRTY@/$(GIT_DIRTY)/ \
117 -e s/@RAILCONTROL_VERSION@/$(RAILCONTROL_VERSION)/ \
118 < $< > $@