Unify the Emscripten and non-Emscripten builds (#9417)

This commit is contained in:
Oleg Derevenetz
2025-01-08 12:07:35 +08:00
committed by GitHub
parent 20d59ebb91
commit 0cf0b4d1ab
14 changed files with 41 additions and 88 deletions
+3 -4
View File
@@ -98,8 +98,7 @@ android/app/src/main/assets/
.DS_Store
# Web build artifacts
*.wasm
*.wasm.map
fheroes2.js
fheroes2.data
src/dist/web/dist/*
fheroes2.js
fheroes2.wasm
fheroes2.wasm.map
+2 -2
View File
@@ -1,6 +1,6 @@
###########################################################################
# fheroes2: https://github.com/ihhub/fheroes2 #
# Copyright (C) 2021 - 2024 #
# Copyright (C) 2021 - 2025 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -60,4 +60,4 @@ endif
clean:
$(MAKE) -C src/dist clean
$(MAKE) -C files/lang clean
rm -rf fheroes2 fheroes2.app
-rm -rf fheroes2 fheroes2.app
+5 -4
View File
@@ -30,9 +30,10 @@ all: fheroes2.js
fheroes2.js: translations
$(MAKE) -C src/dist PLATFORM=emscripten
cp src/dist/fheroes2-ems/fheroes2.data .
cp src/dist/fheroes2-ems/fheroes2.js .
cp src/dist/fheroes2-ems/fheroes2.wasm .
cp src/dist/fheroes2/fheroes2.data .
cp src/dist/fheroes2/fheroes2.js .
# The fheroes2.wasm.map file can also be generated in debug mode
cp src/dist/fheroes2/fheroes2.wasm* .
translations:
$(MAKE) -C files/lang
@@ -40,4 +41,4 @@ translations:
clean:
$(MAKE) -C src/dist clean
$(MAKE) -C files/lang clean
rm -f fheroes2.data fheroes2.js fheroes2.wasm
-rm -f fheroes2.data fheroes2.js fheroes2.wasm*
+2 -2
View File
@@ -1,6 +1,6 @@
###########################################################################
# fheroes2: https://github.com/ihhub/fheroes2 #
# Copyright (C) 2021 - 2024 #
# Copyright (C) 2021 - 2025 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -40,4 +40,4 @@ all:
clean:
$(MAKE) -C src/dist clean
rm -f fheroes2.elf fheroes2.nacp fheroes2.nro
-rm -f fheroes2.elf fheroes2.nacp fheroes2.nro
+2 -2
View File
@@ -41,7 +41,7 @@ fheroes2.vpk: eboot.bin param.sfo translations
--add files/data=files/data \
--add files/lang/vita_temp=files/lang \
fheroes2.vpk
rm -r files/lang/vita_temp
rm -rf files/lang/vita_temp
translations: fheroes2.elf
$(MAKE) -C files/lang
@@ -65,4 +65,4 @@ fheroes2.elf:
clean:
$(MAKE) -C src/dist clean
$(MAKE) -C files/lang clean
rm -f fheroes2.velf fheroes2.elf fheroes2.vpk eboot.bin param.sfo
-rm -f fheroes2.velf fheroes2.elf fheroes2.vpk eboot.bin param.sfo
+2 -2
View File
@@ -1,6 +1,6 @@
###########################################################################
# fheroes2: https://github.com/ihhub/fheroes2 #
# Copyright (C) 2022 - 2024 #
# Copyright (C) 2022 - 2025 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -40,4 +40,4 @@ all:
sed -e '$(SEDEX)' fheroes2.6.in > fheroes2.6
clean:
rm -f fheroes2.6
-rm -f fheroes2.6
+2 -2
View File
@@ -1,6 +1,6 @@
###########################################################################
# fheroes2: https://github.com/ihhub/fheroes2 #
# Copyright (C) 2024 #
# Copyright (C) 2024 - 2025 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -65,4 +65,4 @@ ro.mo: ro.po
sed -e 'y/äëïöőüűÄËÏŐÖÜŰ/aeioouuAEIOOUU/' $< | $(ICONV) -f utf-8 -t ascii//TRANSLIT | msgfmt - -o $@
clean:
rm -f *.mo *.po~
-rm -f *.mo *.po~
+9 -11
View File
@@ -80,6 +80,14 @@ endif
include Makefile.$(PLATFORM)
#
# Name of the main target executable file
# This name can be platform-specific (and can already be defined in a platform-specific Makefile)
#
ifeq ($(origin TARGET),undefined)
TARGET := fheroes2
endif
#
# Build options for third-party libraries
#
@@ -150,7 +158,7 @@ endif
CCFLAGS := $(CCFLAGS) $(SDL_FLAGS)
LIBS := $(SDL_LIBS) $(LIBS)
export CC CXX AR CCFLAGS CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS PLATFORM
export CC CXX AR CCFLAGS CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS TARGET
.PHONY: all clean
@@ -159,23 +167,13 @@ ifndef FHEROES2_WITH_SYSTEM_SMACKER
$(MAKE) -C thirdparty/libsmacker CCFLAGS="$(CCFLAGS_TP)" CFLAGS="$(CFLAGS_TP)" CXXFLAGS="$(CXXFLAGS_TP)" CPPFLAGS="$(CPPFLAGS_TP)"
endif
$(MAKE) -C engine
ifeq ($(PLATFORM),emscripten)
$(MAKE) -C fheroes2-ems
else
$(MAKE) -C fheroes2
endif
ifdef FHEROES2_WITH_TOOLS
$(MAKE) -C tools
endif
clean:
ifndef FHEROES2_WITH_SYSTEM_SMACKER
$(MAKE) -C thirdparty/libsmacker clean
endif
$(MAKE) -C engine clean
ifeq ($(PLATFORM),emscripten)
$(MAKE) -C fheroes2-ems clean
else
$(MAKE) -C fheroes2 clean
endif
$(MAKE) -C tools clean
+4 -1
View File
@@ -18,10 +18,13 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
###########################################################################
TARGET := fheroes2.js
CCFLAGS := $(filter-out -pthread,$(CCFLAGS)) \
--use-port=sdl2 \
--use-port=sdl2_mixer \
--use-port=zlib
--use-port=zlib \
-sSDL2_MIXER_FORMATS=mid,mp3,ogg
LDFLAGS := $(filter-out -pthread,$(LDFLAGS)) \
--preload-file ../../../files/data/resurrection.h2d@/files/data/resurrection.h2d \
+2 -2
View File
@@ -1,6 +1,6 @@
###########################################################################
# fheroes2: https://github.com/ihhub/fheroes2 #
# Copyright (C) 2021 - 2024 #
# Copyright (C) 2021 - 2025 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -37,4 +37,4 @@ libengine.a: $(notdir $(patsubst %.cpp, %.o, $(wildcard $(SOURCEDIR)/*.cpp)))
include $(wildcard *.d)
clean:
rm -f *.d *.o libengine.a
-rm -f *.d *.o libengine.a
-48
View File
@@ -1,48 +0,0 @@
###########################################################################
# fheroes2: https://github.com/ihhub/fheroes2 #
# Copyright (C) 2025 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the #
# Free Software Foundation, Inc., #
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
###########################################################################
DEPLIBS := ../engine/libengine.a
CCFLAGS := $(CCFLAGS) -I../../engine
ifndef FHEROES2_WITH_SYSTEM_SMACKER
DEPLIBS := $(DEPLIBS) ../thirdparty/libsmacker/libsmacker.a
CCFLAGS := $(CCFLAGS) -I../../thirdparty/libsmacker
endif
SOURCEROOT := ../../fheroes2
SOURCEDIRS := $(filter %/,$(wildcard $(SOURCEROOT)/*/))
SOURCES := $(wildcard $(SOURCEROOT)/*/*.cpp)
VPATH := $(SOURCEDIRS)
.PHONY: all clean
all: fheroes2.js
fheroes2.js: $(notdir $(patsubst %.cpp, %.o, $(SOURCES))) $(DEPLIBS)
$(CXX) -o $@ $^ $(LIBS) $(LDFLAGS)
%.o: %.cpp
$(CXX) -c -MD $< $(addprefix -I, $(SOURCEDIRS)) $(CCFLAGS) $(CXXFLAGS) $(CPPFLAGS)
include $(wildcard *.d)
clean:
rm -f *.d *.o fheroes2.data fheroes2.js fheroes2.wasm
+4 -4
View File
@@ -1,6 +1,6 @@
###########################################################################
# fheroes2: https://github.com/ihhub/fheroes2 #
# Copyright (C) 2021 - 2024 #
# Copyright (C) 2021 - 2025 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -34,11 +34,11 @@ VPATH := $(SOURCEDIRS)
.PHONY: all pot clean
all: fheroes2 pot
all: $(TARGET) pot
pot: fheroes2.pot
fheroes2: $(notdir $(patsubst %.cpp, %.o, $(SOURCES))) $(DEPLIBS)
$(TARGET): $(notdir $(patsubst %.cpp, %.o, $(SOURCES))) $(DEPLIBS)
$(CXX) -o $@ $^ $(LIBS) $(LDFLAGS)
fheroes2.pot: $(SOURCES)
@@ -51,4 +51,4 @@ fheroes2.pot: $(SOURCES)
include $(wildcard *.d)
clean:
rm -f *.d *.o fheroes2 fheroes2.pot fheroes2.pot~
-rm -f *.d *.o fheroes2 fheroes2.*
+2 -2
View File
@@ -1,6 +1,6 @@
###########################################################################
# fheroes2: https://github.com/ihhub/fheroes2 #
# Copyright (C) 2022 - 2024 #
# Copyright (C) 2022 - 2025 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -31,4 +31,4 @@ smacker.o: ../../../thirdparty/libsmacker/smacker.c
include $(wildcard *.d)
clean:
rm -f *.d *.o libsmacker.a
-rm -f *.d *.o libsmacker.a
+2 -2
View File
@@ -1,6 +1,6 @@
###########################################################################
# fheroes2: https://github.com/ihhub/fheroes2 #
# Copyright (C) 2021 - 2024 #
# Copyright (C) 2021 - 2025 #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -33,4 +33,4 @@ $(TARGETS): %: %.o ../engine/libengine.a
include $(wildcard *.d)
clean:
rm -f *.d *.o $(TARGETS)
-rm -f *.d *.o $(TARGETS)