Skip to content

Commit

Permalink
Top level Makefile Upgraded
Browse files Browse the repository at this point in the history
The top level makefile now handles the building of nuklear.h, docs, and
demos.

Doing this, not only provides a more familar interface for C
programmers, but allows the build system to become simplified. Using
`make` can take advantage of multiple processes and threading. Next up
in the line will be updating the workflow to take advantage of these
properties.
  • Loading branch information
awschult002 authored and RobLoach committed Nov 17, 2024
1 parent 5eea89c commit 50021f5
Showing 1 changed file with 70 additions and 16 deletions.
86 changes: 70 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,36 +1,90 @@

docs_path:=./doc
doxyfile:=$(docs_path)/Doxyfile
######################################################################################
## SETTINGS ##
######################################################################################

## path stuff
DOCS_PATH:=./doc
DEMO_PATH=demo
SRC_PATH=src


.PHONY: usage
## Documents settings
DOXYFILE:=$(DOCS_PATH)/Doxyfile


## HEADER file packing settings
## note: source file paths are prefixed later, no need to add prefix here; just
## give it the name.
MACRO = NK
INTRO = HEADER.md
PUB = nuklear.h
OUTPUT = nuklear.h

PRIV1 = nuklear_internal.h nuklear_math.c nuklear_util.c nuklear_color.c nuklear_utf8.c nuklear_buffer.c nuklear_string.c nuklear_draw.c nuklear_vertex.c

EXTERN = stb_rect_pack.h stb_truetype.h

PRIV2 = nuklear_font.c nuklear_input.c nuklear_style.c nuklear_context.c nuklear_pool.c nuklear_page_element.c nuklear_table.c nuklear_panel.c nuklear_window.c nuklear_popup.c nuklear_contextual.c nuklear_menu.c nuklear_layout.c nuklear_tree.c nuklear_group.c nuklear_list_view.c nuklear_widget.c nuklear_text.c nuklear_image.c nuklear_9slice.c nuklear_button.c nuklear_toggle.c nuklear_selectable.c nuklear_slider.c nuklear_knob.c nuklear_progress.c nuklear_scrollbar.c nuklear_text_editor.c nuklear_edit.c nuklear_property.c nuklear_chart.c nuklear_color_picker.c nuklear_combo.c nuklear_tooltip.c

OUTRO = LICENSE CHANGELOG CREDITS

## Demo settings
DEMO_LIST = $(shell find $(DEMO_PATH) -type f -name Makefile -printf "%h ")

######################################################################################
## RECIPES ##
######################################################################################


.PHONY: usage all demos $(DEMO_LIST)

usage:
echo "make docs to create documentation"
echo "make nuke to rebuild the single header nuklear.h from source"
echo "make demos to build all of the demos
echo "make all to re-pack the header and create documentation"
echo "make install to "install" man files"

all: docs nuke demos
demos: $(DEMO_LIST)


########################################################################################
## Nuklear.h

docs: $(docs_path)/html/index.html
nuke: $(addprefix $(SRC_PATH)/, $(SRC))
python3 $(SRC_PATH)/build.py --macro $(MACRO) --intro $(addprefix $(SRC_PATH)/, $(INTRO)) --pub $(addprefix $(SRC_PATH)/, $(PUB)) --priv1 "$(addprefix $(SRC_PATH)/, $(PRIV1))" --extern "$(addprefix $(SRC_PATH)/, $(EXTERN))" --priv2 "$(addprefix $(SRC_PATH)/, $(PRIV2))" --outro "$(addprefix $(SRC_PATH)/, $(OUTRO))" > $(OUTPUT)

$(docs_path)/html/index.html: $(docs_path)/doxygen-awesome-css/doxygen-awesome.css $(doxyfile)
doxygen $(doxyfile)

$(doxyfile):



########################################################################################
## Docs

docs: $(DOCS_PATH)/html/index.html

$(DOCS_PATH)/html/index.html: $(DOCS_PATH)/doxygen-awesome-css/doxygen-awesome.css $(DOXYFILE)
doxygen $(DOXYFILE)

$(DOXYFILE):
doxygen -g $@

$(docs_path)/doxygen-awesome-css/doxygen-awesome.css:
git clone https://github.com/jothepro/doxygen-awesome-css.git $(docs_path)/doxygen-awesome-css --branch v2.3.4
$(DOCS_PATH)/doxygen-awesome-css/doxygen-awesome.css:
git clone https://github.com/jothepro/doxygen-awesome-css.git $(DOCS_PATH)/doxygen-awesome-css --branch v2.3.4

nuke:
cd ./src && ./paq.sh

all: docs nuke

install:
########################################################################################
## Demos

$(DEMO_LIST):
$(MAKE) -C $@


clean:
rm -rf $(docs_path)/html

########################################################################################
## Utility helpers

clean:
rm -rf $(DOCS_PATH)/html $(OUTPUT)

0 comments on commit 50021f5

Please sign in to comment.