Skip to content

Commit c6fc0d2

Browse files
committed
webver: Add webver target in Makefile, fix echo output bug, refactoring
1 parent 0fe3918 commit c6fc0d2

1 file changed

Lines changed: 29 additions & 11 deletions

File tree

Makefile

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@
55

66
## path stuff
77
DOCS_PATH:=./doc
8+
# Convenience shortcut to docs output path (as defined in Doxyfile)
9+
DOCS_OUT:=$(DOCS_PATH)/html
10+
811
DEMO_PATH=demo
912
SRC_PATH=src
1013

14+
WEBVER_BACKEND:=./demo/sdl3_renderer
15+
WEBVER_SITE:=./webver/site
16+
WEBVER_OUT:=$(DOCS_OUT)/webver
17+
WEBVER_CFLAGS:=-O2 -DINCLUDE_ALL -sEXPORTED_RUNTIME_METHODS=requestFullscreen
18+
#Possible choice: ccall,cwrap,requestFullscreen,FS
19+
WEBVER_CFLAGS+=${CFLAGS}
1120

1221
## Documents settings
1322
DOXYFILE:=$(DOCS_PATH)/Doxyfile
@@ -37,15 +46,16 @@ DEMO_LIST = $(shell find $(DEMO_PATH) -type f -name Makefile -printf "%h ")
3746
######################################################################################
3847

3948

40-
.PHONY: usage all demos $(DEMO_LIST)
49+
.PHONY: usage all demos webver $(DEMO_LIST)
4150

4251
usage:
43-
echo "make docs to create documentation"
44-
echo "make nuke to rebuild the single header nuklear.h from source"
45-
echo "make demos to build all of the demos"
46-
echo "make all to re-pack the header and create documentation"
52+
@echo "make docs to create documentation"
53+
@echo "make webver to build webversion on SDL3 + Emscripten (try to run 'embuilder build sdl3' if first time)"
54+
@echo "make nuke to rebuild the single header nuklear.h from source"
55+
@echo "make demos to build all of the demos"
56+
@echo "make all to re-pack the header and create documentation"
4757

48-
all: docs nuke demos
58+
all: docs webver nuke demos
4959
demos: $(DEMO_LIST)
5060

5161

@@ -57,14 +67,12 @@ nuke: $(addprefix $(SRC_PATH)/, $(SRC))
5767

5868

5969

60-
61-
6270
########################################################################################
6371
## Docs
6472

65-
docs: $(DOCS_PATH)/html/index.html
73+
docs: $(DOCS_OUT)/index.html
6674

67-
$(DOCS_PATH)/html/index.html: $(DOCS_PATH)/doxygen-awesome-css/doxygen-awesome.css $(DOXYFILE)
75+
$(DOCS_OUT)/index.html: $(DOCS_PATH)/doxygen-awesome-css/doxygen-awesome.css $(DOXYFILE)
6876
doxygen $(DOXYFILE)
6977

7078
$(DOXYFILE):
@@ -75,6 +83,16 @@ $(DOCS_PATH)/doxygen-awesome-css/doxygen-awesome.css:
7583

7684

7785

86+
########################################################################################
87+
## webver
88+
89+
webver:
90+
mkdir -p $(WEBVER_OUT)
91+
emmake make -C $(WEBVER_BACKEND) CFLAGS="$(WEBVER_CFLAGS)" BIN=$(abspath $(WEBVER_OUT)/demo_sdl3_renderer.js) TEMPDIR=$(abspath $(WEBVER_OUT))
92+
cp -r $(WEBVER_SITE)/* $(WEBVER_OUT)/
93+
#[NOTE]We pass TEMPDIR directly for hide a potential issue
94+
95+
7896
########################################################################################
7997
## Demos
8098

@@ -87,4 +105,4 @@ $(DEMO_LIST):
87105
## Utility helpers
88106

89107
clean:
90-
rm -rf $(DOCS_PATH)/html $(OUTPUT)
108+
rm -rf $(DOCS_OUT) $(OUTPUT)

0 commit comments

Comments
 (0)