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

Use pattern matching and Makefile functions to enable building and starting multiple different ofrak images #546

Open
Jepson2k opened this issue Dec 27, 2024 · 1 comment
Assignees
Milestone

Comments

@Jepson2k
Copy link
Collaborator

What is the use case for the feature?
Ofrak uses a comprehensive build system and exposes multiple baseline files (ofrak-core-dev, ofrak-dev, ofrak-angr, etc.) but the makefile only supports building ofrak-core-dev by default. We can use pattern matching and makefile functions to enable users to build and start any of these by default without excessive repetition in the Makefile.

Does the feature contain any proprietary information about another company's intellectual property?
No

How would you implement this feature?
Something like this:

define build_ofrak_image
	@echo "Building OFRAK image using config: $(1).yml"
	python3 build_image.py --config $(1).yml --base --finish --target install
endef

# Pattern rule for building images named "ofrak-<something>.yml".
# Usage examples:
#   make ofrak-dev         -> builds with ofrak-dev.yml
#   make ofrak-angr        -> builds with ofrak-angr.yml
#   make ofrak-binary-ninja-> builds with ofrak-binary-ninja.yml
#   make ofrak-core-dev    -> builds with ofrak-core-dev.yml
#   make ofrak-ghidra      -> builds with ofrak-ghidra.yml
#   make ofrak-tutorial    -> builds with ofrak-tutorial.yml
.PHONY: ofrak-%
ofrak-%: ## Build OFRAK image using ofrak-<name>.yml
	$(call build_ofrak_image,ofrak-$*)

# For compatibility, this target calls the pattern rule for "ofrak-core-dev"
# so "make image" continues to work as before.
.PHONY: image
image: ofrak-core-dev ## Build ofrak-core-dev image

Are there any (reasonable) alternative approaches?
Unsure

Are you interested in implementing it yourself?
Yes

@whyitfor
Copy link
Contributor

whyitfor commented Jan 2, 2025

Generally intrigued by this idea.

@rbs-jacob, can you work iwth @Jepson2k to align on an approach that makes sense to you?

@rbs-jacob rbs-jacob linked a pull request Jan 6, 2025 that will close this issue
1 task
@rbs-jacob rbs-jacob added this to the 3.3.0 Release milestone Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants