Skip to content

Commit

Permalink
Makefile: use g++ for C++ source files and gcc for C source files
Browse files Browse the repository at this point in the history
Signed-off-by: Jussi Kivilinna <[email protected]>
  • Loading branch information
jkivilin committed Oct 13, 2024
1 parent 41424a6 commit edf280d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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
Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
##

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 Down Expand Up @@ -65,11 +67,11 @@ SRC = bot.cpp \
OBJ = $(SRC:%.cpp=%.o)

${TARGET}${DLLEND}: zlib/libz.a ${OBJ}
${CPP} -o $@ ${OBJ} zlib/libz.a ${LINKFLAGS}
${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
Expand Down

0 comments on commit edf280d

Please sign in to comment.