Browse Source

DJGPP build

despair 1 year ago
parent
commit
fdda1562ed
2 changed files with 105 additions and 0 deletions
  1. 103
    0
      DJMakefile
  2. 2
    0
      legacy-ci.sh

+ 103
- 0
DJMakefile View File

@@ -0,0 +1,103 @@
1
+UNAME := $(shell uname)
2
+CXX        = gpp
3
+CC    = gcc
4
+
5
+GIT_VERSION := $(shell git describe --abbrev=4 --always --tags)
6
+PLATFORM := $(shell g++ -dumpmachine)
7
+
8
+CXXFLAGS   = -O3 -flto=8 -std=c++14 -DVERSION=\"$(GIT_VERSION)\" -DPLATFORM=\"$(PLATFORM)\"
9
+CFLAGS   = -O3 -flto=8 -std=c11 -DVERSION=\"$(GIT_VERSION)\"
10
+CWARN	= -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wredundant-decls -Wshadow -Wsign-conversion   -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused
11
+WARNINGS   = -Werror -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused -Wzero-as-null-pointer-constant -Wuseless-cast
12
+LIBS       = -lglfw -lGL -lGLEW -lfreetype -lharfbuzz -lmbedtls -lmbedcrypto -lmbedx509
13
+LDFLAGS    = -O3 -flto=8
14
+INCPATH    = -I /usr/include/freetype2 -I /usr/include/harfbuzz
15
+MD5SUM     = md5sum
16
+
17
+ifeq ($(UNAME), Darwin)
18
+CXXFLAGS   = -O3 -std=c++1y -DVERSION=\"$(GIT_VERSION)\" -DPLATFORM=\"$(PLATFORM)\"
19
+CFLAGS	   = -O3 -std=c11 -DVERSION=\"$(GIT_VERSION)\"
20
+WARNINGS   =
21
+ifneq ("$(wildcard /usr/local/lib/libglfw3.a)","") 
22
+CWARN	   =
23
+LIBS = -lglfw3 -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lGLEW -lfreetype -lharfbuzz -lmbedtls -lmbedcrypto -lmbedx509 \
24
+else
25
+LIBS = -lglfw3 -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -lGLEW -lfreetype -lharfbuzz -lmbedtls -lmbedcrypto -lmbedx509
26
+endif
27
+LDFLAGS    = -O3 -L/usr/local/lib
28
+INCPATH    = -I /usr/local/include -I /usr/local/include/freetype2 -I /usr/local/include/harfbuzz
29
+MD5SUM     = md5
30
+endif
31
+
32
+EXECUTABLE = netrunner
33
+LINK       = g++
34
+
35
+SRCDIR     = src
36
+OBJDIR     = gen
37
+DEPDIR     = d
38
+
39
+SOURCES = $(subst ./,,$(shell find src -name \*.cpp))
40
+OBJECTS = $(subst $(SRCDIR),$(OBJDIR),$(SOURCES:.cpp=.o))
41
+
42
+all: $(SOURCES) netrunner
43
+
44
+netrunner: $(OBJECTS) $(OBJDIR)/tlsf.o
45
+	$(LINK) $(LDFLAGS) -o $@ $^ $(LIBS)
46
+
47
+# make make 3.81 happy (since it can't parse any echo parameters)
48
+ifeq ($(UNAME), Darwin)
49
+shaders:
50
+ifneq ($(shell cat src/graphics/opengl/shaders/FontShader.vert src/graphics/opengl/shaders/FontShader.frag src/graphics/opengl/shaders/TextureShader.vert src/graphics/opengl/shaders/TextureShader.frag | $(MD5SUM)), $(shell cat src/graphics/opengl/shaders/gen/hashsum))
51
+	@mkdir -p "src/graphics/opengl/shaders/gen"
52
+	@echo "#ifndef FONTSHADER_H\n#define FONTSHADER_H\n\nconst char *fontVertexShaderSource =\n" > src/graphics/opengl/shaders/gen/FontShader.h;
53
+	@cat src/graphics/opengl/shaders/FontShader.vert | awk '{if ($$0!="}") {print "\t\""$$0"\\n\""} else {print "\t\""$$0"\";\n"}}' >> src/graphics/opengl/shaders/gen/FontShader.h;
54
+	@echo "const char *fontFragmentShaderSource =\n" >> src/graphics/opengl/shaders/gen/FontShader.h;
55
+	@cat src/graphics/opengl/shaders/FontShader.frag | awk '{if ($$0!="}") {print "\t\""$$0"\\n\""} else {print "\t\""$$0"\";\n"}}' >> src/graphics/opengl/shaders/gen/FontShader.h;
56
+	@echo "#endif\n" >> src/graphics/opengl/shaders/gen/FontShader.h;
57
+	@echo "#ifndef TEXTURESHADER_H\n#define TEXTURESHADER_H\n\nconst char *textureVertexShaderSource =\n" > src/graphics/opengl/shaders/gen/TextureShader.h;
58
+	@cat src/graphics/opengl/shaders/TextureShader.vert | awk '{if ($$0!="}") {print "\t\""$$0"\\n\""} else {print "\t\""$$0"\";\n"}}' >> src/graphics/opengl/shaders/gen/TextureShader.h;
59
+	@echo "const char *textureFragmentShaderSource =\n" >> src/graphics/opengl/shaders/gen/TextureShader.h;
60
+	@cat src/graphics/opengl/shaders/TextureShader.frag | awk '{if ($$0!="}") {print "\t\""$$0"\\n\""} else {print "\t\""$$0"\";\n"}}' >> src/graphics/opengl/shaders/gen/TextureShader.h;
61
+	@echo "#endif\n" >> src/graphics/opengl/shaders/gen/TextureShader.h;
62
+	@cat src/graphics/opengl/shaders/FontShader.vert src/graphics/opengl/shaders/FontShader.frag src/graphics/opengl/shaders/TextureShader.vert src/graphics/opengl/shaders/TextureShader.frag | $(MD5SUM) > src/graphics/opengl/shaders/gen/hashsum;
63
+endif
64
+else
65
+shaders:
66
+ifneq ($(shell cat src/graphics/opengl/shaders/FontShader.vert src/graphics/opengl/shaders/FontShader.frag src/graphics/opengl/shaders/TextureShader.vert src/graphics/opengl/shaders/TextureShader.frag | $(MD5SUM)), $(shell cat src/graphics/opengl/shaders/gen/hashsum))
67
+	@mkdir -p "src/graphics/opengl/shaders/gen"
68
+	@cat src/graphics/opengl/shaders/FontShader.vert src/graphics/opengl/shaders/FontShader.frag src/graphics/opengl/shaders/TextureShader.vert src/graphics/opengl/shaders/TextureShader.frag | $(MD5SUM) > src/graphics/opengl/shaders/gen/hashsum;
69
+	@/bin/echo -ne "#ifndef FONTSHADER_H\n#define FONTSHADER_H\n\nconst char *fontVertexShaderSource =\n" > src/graphics/opengl/shaders/gen/FontShader.h;
70
+	@cat src/graphics/opengl/shaders/FontShader.vert | awk '{if ($$0!="}") {print "\t\""$$0"\\n\""} else {print "\t\""$$0"\";\n"}}' >> src/graphics/opengl/shaders/gen/FontShader.h;
71
+	@/bin/echo -ne "const char *fontFragmentShaderSource =\n" >> src/graphics/opengl/shaders/gen/FontShader.h;
72
+	@cat src/graphics/opengl/shaders/FontShader.frag | awk '{if ($$0!="}") {print "\t\""$$0"\\n\""} else {print "\t\""$$0"\";\n"}}' >> src/graphics/opengl/shaders/gen/FontShader.h;
73
+	@/bin/echo -ne "#endif\n" >> src/graphics/opengl/shaders/gen/FontShader.h;
74
+	@/bin/echo -ne "#ifndef TEXTURESHADER_H\n#define TEXTURESHADER_H\n\nconst char *textureVertexShaderSource =\n" > src/graphics/opengl/shaders/gen/TextureShader.h;
75
+	@cat src/graphics/opengl/shaders/TextureShader.vert | awk '{if ($$0!="}") {print "\t\""$$0"\\n\""} else {print "\t\""$$0"\";\n"}}' >> src/graphics/opengl/shaders/gen/TextureShader.h;
76
+	@/bin/echo -ne "const char *textureFragmentShaderSource =\n" >> src/graphics/opengl/shaders/gen/TextureShader.h;
77
+	@cat src/graphics/opengl/shaders/TextureShader.frag | awk '{if ($$0!="}") {print "\t\""$$0"\\n\""} else {print "\t\""$$0"\";\n"}}' >> src/graphics/opengl/shaders/gen/TextureShader.h;
78
+	@/bin/echo -ne "#endif\n" >> src/graphics/opengl/shaders/gen/TextureShader.h;
79
+endif
80
+endif
81
+
82
+$(OBJDIR)/%.o: $(SRCDIR)/%.cpp | shaders
83
+	@mkdir -p $(@D)
84
+	@mkdir -p $(subst gen,d,$(@D))
85
+	$(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARNINGS) -c -o $@ $<
86
+	@mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $@
87
+
88
+$(OBJDIR)/tlsf.o: $(SRCDIR)/tlsf.c
89
+	$(CC) $(INCPATH) $(CWARN) -DTLSF_USE_LOCKS=0 -DUSE_SBRK=1 -c -o $@ $<
90
+
91
+$(DEPDIR)/%d: ;
92
+.PRECIOUS: $(DEPDIR)/%.d
93
+
94
+test-url.o: tests/testPrograms/URLtest.cpp
95
+	$(CXX) -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td $(CXXFLAGS) $(INCPATH) $(WARINGS) -c -o $@ $<
96
+
97
+ntr-run-tests: test-url.o $(OBJDIR)/URL.o $(OBJDIR)/StringUtils.o
98
+	$(LINK) $(LDFLAGS) -o $@ test-url.o $(OBJDIR)/URL.o $(OBJDIR)/StringUtils.o $(LIBS)
99
+
100
+clean:
101
+	-@rm -rf src/graphics/opengl/shaders/gen $(OBJDIR) $(EXECUTABLE) 2>/dev/null || true
102
+
103
+include $(addsuffix .d,$(subst $(SRCDIR),$(DEPDIR),$(basename $(SOURCES))))

+ 2
- 0
legacy-ci.sh View File

@@ -0,0 +1,2 @@
1
+#!/usr/bin/sh
2
+ssh -p 2738 rick@68.203.167.111 ./build-msdos