Skip to content

Commit

Permalink
Merge pull request #11 from Bots-United/fix-PR-workflow-fix-compiler-…
Browse files Browse the repository at this point in the history
…flags

Fix PR workflow and compiler flags
  • Loading branch information
jkivilin authored Oct 13, 2024
2 parents f2fcefa + edf280d commit 603291e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ jobs:
- name: Update package list for i386
run: sudo dpkg --add-architecture i386 && sudo apt-get -y update
- name: Install packages
run: sudo apt-get -y install build-essential g++-multilib gcc-mingw-w64
run: sudo apt-get -y install build-essential g++-multilib gcc-mingw-w64 g++-mingw-w64
- name: make
run: make
- name: cleanup 1
run: git clean -xdf
- name: make win32
run: make OSTYPE=win32
- name: cleanup 2
run: git clean -xdf
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
##
## compiling under ubuntu:
## for compiling linux: make
## for compiling linux: make
## for compiling win32: make OSTYPE=win32
##

ifeq ($(OSTYPE),win32)
CPP = i686-w64-mingw32-gcc -m32
CPP = i686-w64-mingw32-g++ -m32
CC = i686-w64-mingw32-gcc -m32
AR = i686-w64-mingw32-ar rc
RANLIB = i686-w64-mingw32-ranlib
LINKFLAGS = -mdll -lm -lwsock32 -lws2_32 -Xlinker --add-stdcall-alias -s
DLLEND = .dll
ZLIB_OSFLAGS =
else
CPP = gcc -m32
CPP = g++ -m32
CC = gcc -m32
AR = ar rc
RANLIB = ranlib
ARCHFLAG = -fPIC
Expand All @@ -23,15 +25,13 @@ endif

TARGET = jk_botti_mm
BASEFLAGS = -Wall -Wno-write-strings
BASEFLAGS += -fno-strict-aliasing -fno-strict-overflow
ARCHFLAG += -march=i686 -mtune=generic -msse -msse2 -msse3

ifeq ($(DBG_FLGS),1)
OPTFLAGS = -O0 -g
else
OPTFLAGS = -O2 -fomit-frame-pointer -g
OPTFLAGS += -funsafe-math-optimizations
LTOFLAGS = -flto -fvisibility=hidden
LINKFLAGS += ${OPTFLAGS} ${LTOFLAGS}
endif

INCLUDES = -I"./metamod" \
Expand All @@ -41,7 +41,7 @@ INCLUDES = -I"./metamod" \
-I"./pm_shared"

CFLAGS = ${BASEFLAGS} ${OPTFLAGS} ${ARCHFLAG} ${INCLUDES}
CPPFLAGS = -fno-rtti -fno-exceptions ${CFLAGS}
CPPFLAGS = -fno-rtti -fno-exceptions ${CFLAGS}

SRC = bot.cpp \
bot_chat.cpp \
Expand All @@ -66,15 +66,15 @@ SRC = bot.cpp \

OBJ = $(SRC:%.cpp=%.o)

${TARGET}${DLLEND}: zlib/libz.a ${OBJ}
${CPP} -o $@ ${OBJ} zlib/libz.a ${LINKFLAGS}
${TARGET}${DLLEND}: zlib/libz.a ${OBJ}
${CC} -o $@ ${OBJ} zlib/libz.a ${LINKFLAGS}
cp $@ addons/jk_botti/dlls/

zlib/libz.a:
(cd zlib; AR="${AR}" RANLIB="${RANLIB}" CC="${CPP} ${OPTFLAGS} ${ARCHFLAG} ${ZLIB_OSFLAGS} -DASMV" ./configure; $(MAKE) OBJA=match.o; cd ..)
(cd zlib; AR="${AR}" RANLIB="${RANLIB}" CC="${CC} ${OPTFLAGS} ${ARCHFLAG} ${ZLIB_OSFLAGS} -DASMV" ./configure; $(MAKE) OBJA=match.o; cd ..)

clean:
rm -f *.o ${TARGET}${DLLEND} Rules.depend zlib/*.exe
rm -f *.o ${TARGET}${DLLEND} Rules.depend zlib/*.exe
(cd zlib; $(MAKE) clean; cd ..)
rm -f zlib/Makefile

Expand All @@ -89,10 +89,10 @@ distclean:
# ${CPP} ${CPPFLAGS} -funroll-loops -c $< -o $@

%.o: %.cpp
${CPP} ${CPPFLAGS} ${LTOFLAGS} -c $< -o $@
${CPP} ${CPPFLAGS} -c $< -o $@

%.o: %.c
${CPP} ${CFLAGS} ${LTOFLAGS} -c $< -o $@
${CPP} ${CFLAGS} -c $< -o $@

depend: Rules.depend

Expand Down
6 changes: 3 additions & 3 deletions dlls/extdll.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
#endif

// Misc C-runtime library headers
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

// Header file containing definition of globalvars_t and entvars_t
typedef int func_t; //
Expand Down

0 comments on commit 603291e

Please sign in to comment.