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 76 77 78 79 80 81 82 83 84
|
RAILCONTROL_VERSION := 24
CXXFLAGS=-I. -g -O2 -Wall -Wextra -pedantic -Werror -Wno-missing-braces -std=c++11 -D_GNU_SOURCE
CXXFLAGSAMALGAMATION=-I. -g -O2 -Wall -Wextra -pedantic -Werror -Wno-missing-braces -std=c++11
LDFLAGS=-g
LIBS=-lpthread -ldl -lz -lsqlite3
LIBSAMALGAMATION=-lpthread -ldl
ifeq ($(OS),Windows_NT)
LDFLAGS+= -static
endif
TMPDIR=/tmp/RailControl
TMPDIRCYGWIN=/RailControl
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))
OBJ=$(CXXOBJ)
all: $(OBJ)
$(CXX) $(LDFLAGS) $(OBJ) -o railcontrol $(LIBS)
strip: all
strip railcontrol
dist: all
strip railcontrol
mkdir $(TMPDIR)
cp -r \
html \
railcontrol.conf.dist \
railcontrol \
$(TMPDIR)
( cd $(TMPDIR)/.. && tar cvJf railcontrol.`date +"%Y%m%d"`.tar.xz RailControl/* )
rm -r $(TMPDIR)
dist-cygwin: all
strip railcontrol.exe
mkdir $(TMPDIRCYGWIN)
cp -r \
/cygdrive/c/Windows/SYSTEM32/ntdll.dll \
/cygdrive/c/Windows/system32/KERNELBASE.dll \
/cygdrive/c/Windows/system32/kernel32.dll \
/usr/bin/cygwin1.dll \
html \
railcontrol.conf.dist \
railcontrol.exe \
$(TMPDIRCYGWIN)
zip -9 railcontrol.windows.`date +"%Y%m%d"`.zip $(TMPDIRCYGWIN)/* $(TMPDIRCYGWIN)/html/*
rm -r $(TMPDIRCYGWIN)
amalgamation.cpp:
./amalgamation.bash
amalgamation: amalgamation.o Version.cpp
$(CXX) -g amalgamation.o -o railcontrol $(LIBSAMALGAMATION)
strip railcontrol
rm -f amalgamation.o
rm -f amalgamation.cpp
sqlite-shell:
make -C Storage/sqlite
Version.o: Version.cpp Version.h
$(CXX) $(CXXFLAGS) -c -o $@ $<
%.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
$(CXX) $(CXXFLAGS) -c -o $@ $<
.PHONY: clean
clean:
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
rm -f railcontrol
clean-sqlite-shell:
make -C Storage/sqlite clean
test:
make -C test
tools:
make -C tools
|