-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
66 lines (55 loc) · 2.65 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
CPP = sokol/sokol_app.h
CPP += sokol/sokol_gfx.h
CPP += sokol/sokol_time.h
CPP += sokol/sokol_glue.h
CPP += imgui/imgui_draw.cpp
CPP += imgui/imgui_tables.cpp
CPP += imgui/imgui_widgets.cpp
CPP += imgui/imgui_demo.cpp
CPP += imgui/imgui.cpp
CPP += sokol/util/sokol_imgui.h
VERSION=$(shell cd imgui; git describe --tags)
TGZ=imgui_app_$(VERSION).tgz
ZIP=imgui_app_$(VERSION).zip
all: $(TGZ) $(ZIP)
$(TGZ): imgui.h imgui_app.cpp imgui_internal.h sokol.h README.md
@echo "Creating $(TGZ)"
@tar -cvzf $@ $^
$(ZIP): imgui.h imgui_app.cpp imgui_internal.h sokol.h README.md
@echo "Creating $(TGZ)"
@zip $@ $^
.PHONY: header.txt clean
header.txt: imgui sokol
@echo "// ----------------------------------------------------------------------------" > $@
@echo "// File generated by imgui-app. By Jose L. Hidalgo (PpluX) @ 2021" >> $@
@echo "// ----------------------------------------------------------------------------" >> $@
@(cd imgui; git log --pretty="// imgui:%n// %H(%ad)" -1 >> ../header.txt )
@(cd sokol; git log --pretty="// sokol:%n// %H(%ad)" -1 >> ../header.txt )
@echo "// ----------------------------------------------------------------------------" >> $@
imgui.h: src/imgui_app.h imgui/imgui.h header.txt
@cat header.txt > $@
@cat src/imgui_app.h >> $@
@cat imgui/imgui.h >> $@
@sed -e 's/\(#include "imconfig.h"\)/\/\/\1/' -i $@
imgui_app.cpp: header.txt $(CPP) src/imgui_app.cpp
@cat header.txt > $@
@echo "#define SOKOL_IMPL\n#define SOKOL_NO_ENTRY\n\n" >> $@
@echo "#define SOKOL_IMPL\n#define SOKOL_WIN32_FORCE_MAIN\n\n" >> $@
@cat $(CPP) >> $@
# imgui_internal, only replace the first time, remove the other includes
@sed -e '0,/#include "imgui_internal.h"/{ /#include "imgui_internal.h"/{' -e 'r imgui/imgui_internal.h' -e 'd' -e '}}' -i $@
@sed -e 's/#include "imgui_internal.h"//' -i $@
# Other dependencies:
@sed -e '/#include "imstb_textedit.h"/ {' -e 'r imgui/imstb_textedit.h' -e 'd' -e '}' -i $@
@sed -e '/#include "imstb_rectpack.h"/ {' -e 'r imgui/imstb_rectpack.h' -e 'd' -e '}' -i $@
@sed -e '/#include "imstb_truetype.h"/ {' -e 'r imgui/imstb_truetype.h' -e 'd' -e '}' -i $@
@cat src/imgui_app.cpp >> $@
imgui_internal.h: header.txt imgui/imgui_internal.h
@cat $+ > $@
@sed -e '/#include "imstb_textedit.h"/ {' -e 'r imgui/imstb_textedit.h' -e 'd' -e '}' -i $@
@sed -e '/#include "imstb_rectpack.h"/ {' -e 'r imgui/imstb_rectpack.h' -e 'd' -e '}' -i $@
@sed -e '/#include "imstb_truetype.h"/ {' -e 'r imgui/imstb_truetype.h' -e 'd' -e '}' -i $@
sokol.h: header.txt sokol/sokol_app.h sokol/sokol_time.h
@cat $+ > $@
clean:
@rm -f imgui_app.cpp imgui.h imgui_app.tgz header.txt