Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify the Emscripten and non-Emscripten builds #9417

Merged
merged 7 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 #
Expand Down Expand Up @@ -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
9 changes: 5 additions & 4 deletions Makefile.emscripten
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ 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

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*
4 changes: 2 additions & 2 deletions Makefile.switch
Original file line number Diff line number Diff line change
@@ -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 #
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions Makefile.vita
Original file line number Diff line number Diff line change
Expand Up @@ -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
ihhub marked this conversation as resolved.
Show resolved Hide resolved

translations: fheroes2.elf
$(MAKE) -C files/lang
Expand All @@ -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
4 changes: 2 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -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 #
Expand Down Expand Up @@ -40,4 +40,4 @@ all:
sed -e '$(SEDEX)' fheroes2.6.in > fheroes2.6

clean:
rm -f fheroes2.6
-rm -f fheroes2.6
4 changes: 2 additions & 2 deletions files/lang/Makefile
Original file line number Diff line number Diff line change
@@ -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 #
Expand Down Expand Up @@ -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~
20 changes: 9 additions & 11 deletions src/dist/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down Expand Up @@ -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

Expand All @@ -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
5 changes: 4 additions & 1 deletion src/dist/Makefile.emscripten
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions src/dist/engine/Makefile
Original file line number Diff line number Diff line change
@@ -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 #
Expand Down Expand Up @@ -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 changes: 0 additions & 48 deletions src/dist/fheroes2-ems/Makefile

This file was deleted.

8 changes: 4 additions & 4 deletions src/dist/fheroes2/Makefile
Original file line number Diff line number Diff line change
@@ -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 #
Expand Down Expand Up @@ -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)
Expand All @@ -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.*
4 changes: 2 additions & 2 deletions src/dist/thirdparty/libsmacker/Makefile
Original file line number Diff line number Diff line change
@@ -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 #
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/dist/tools/Makefile
Original file line number Diff line number Diff line change
@@ -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 #
Expand Down Expand Up @@ -33,4 +33,4 @@ $(TARGETS): %: %.o ../engine/libengine.a
include $(wildcard *.d)

clean:
rm -f *.d *.o $(TARGETS)
-rm -f *.d *.o $(TARGETS)
Loading