-
Notifications
You must be signed in to change notification settings - Fork 1
/
makeprecompiled
executable file
·43 lines (35 loc) · 1.88 KB
/
makeprecompiled
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
#!/bin/bash
#: Created on: 2016/08/19
#: Author: DmitryHetman
#: Contributors:
#: Description: Make precompiled binaries for ttytanks
#: Synopsis: ./makeprecompilled
[[ $# -ne 0 ]] && grep '^#:' $0 && exit 0 # comment it if you execute it from Makefile
# clang also works good, clang with -O0 should be better for removing warnings
# clang compile slower than gcc, but provide good output
CC=gcc
SRCS="lightsources/main.c lightsources/core.c lightsources/multiplayer.c lightsources/canvas.c lightsources/render.c"
# Warnings, ttytanks with -std=c11 can't be compilled with -Werror, -pedantic-errors, you should add this flags in future,
# now just comment it if you use sources/*.c
WCFLAGS="-Wall -Wextra -pedantic -Werror=pedantic -Wfatal-errors -pedantic-errors -Werror -v"
# -std=c11 not works good, look for warning with clang
# -Ofast -funroll-loops safe options for this game
CFLAGS="${WCFLAGS} -std=gnu11 -Ofast -pthread -funroll-loops -pipe"
# you may need -ltinfo in LDLIBS
LDLIBS="-lpthread -lncurses -lm" #-ltinfo
TARGET='ttytanks'
# Make generic binary for amd64, supposed that it will be compiled on amd64 CPU
$CC ${SRCS} ${LDLIBS} ${CFLAGS} -static -o precompiled/amd64/amd64_static_${TARGET}
# Make binaries for intel 64bit processors:
for march in core2 nehalem westmere sandybridge ivybridge haswell broadwell skylake
do
#$@ -march=${march} -static -o precompiled/intel/${march}_static_${TARGET} # if execute from makefile
$CC ${SRCS} ${LDLIBS} ${CFLAGS} -march=${march} -static -o precompiled/amd64/intel/${march}_static_${TARGET}
#if execute as standalone script
done
# Make binaries for amd 64bit processors:
for march in k8 k8-sse3 barcelona bdver1 bdver2 bdver3 bdver4 znver1 btver1 btver2
do
#$@ -march=${march} -static -o precompiled/amd/${march}_static_${TARGET}
$CC ${SRCS} ${LDLIBS} ${CFLAGS} -march=${march} -static -o precompiled/amd64/amd/${march}_static_${TARGET}
done