Files

185 lines
5.1 KiB
Makefile

-include config.mk
ifeq ($(shell uname),Darwin)
BIN=build/iaito.app/Contents/MacOS/iaito
else
BIN=build/iaito
endif
QMAKE_FLAGS+=-config release
#install_name_tool -change /path/to/Qt/lib/QtCore.framework/Versions/4.0/QtCore
# @executable_path/../Frameworks/QtCore.framework/Versions/4.0/QtCore
# plugandpaint.app/Contents/plugins/libpnp_basictools.dylib
ifeq ($(WANT_PYTHON_BINDINGS),1)
QMAKE_FLAGS+=IAITO_ENABLE_PYTHON_BINDINGS=true
endif
ifeq ($(WANT_DEBUGGER),0)
QMAKE_FLAGS+=IAITO_ENABLE_DEBUGGER=false
else
QMAKE_FLAGS+=IAITO_ENABLE_DEBUGGER=true
endif
ifeq ($(WANT_CRASH_REPORTS),1)
QMAKE_FLAGS+=IAITO_ENABLE_CRASH_REPORTS=true
endif
QMAKE_FLAGS+=PREFIX=$(PREFIX)
INDENT_IMAGE_NAME ?= clang-format-image
INDENT_IMAGE_TAG ?= llvm20
INDENT_IMAGE := $(INDENT_IMAGE_NAME):$(INDENT_IMAGE_TAG)
INDENT_FILES := $(shell find src \( -name '*.cpp' -o -name '*.h' \))
CLANG_FORMAT ?= clang-format-20
all: iaito
CXX?=g++
reset:
rm -rf ~/.config/radareorg/iaito.conf
QTLIBS=$(shell grep "^LIBS" build/Makefile | cut -d = -f 2-)
R2LIBS=$(shell pkg-config --cflags --libs r_core)
R2_LIBEXT=$(shell r2 -H R2_LIBEXT)
R2_USER_PLUGINS=$(shell r2 -H R2_USER_PLUGINS)
plugin core_plugin: iaito
SUBLIBS=true $(CXX) build/*.o src/CorePlugin.cpp -shared -fPIC $(QTLIBS) $(R2LIBS) -o build/CorePlugin.$(R2_LIBEXT)
mkdir -p $(R2_USER_PLUGINS)
rm -f $(R2_USER_PLUGINS)/IaitoPlugin.$(R2_LIBEXT)
cp -f build/CorePlugin.$(R2_LIBEXT) $(R2_USER_PLUGINS)/IaitoPlugin.$(R2_LIBEXT)
asan:
export CXXFLAGS=-fsanitize=address ; \
export CFLAGS=-fsanitize=address ; \
export LDFLAGS=-fsanitize=address ; \
$(MAKE) build && $(MAKE) -C build -j4
clean:
rm -f src/ui_*.h
rm -f src/moc_*
rm -rf build
dist:
ifeq ($(shell uname),Darwin)
$(MAKE) -C dist/macos
else
$(MAKE) -C dist/debian
endif
mrproper: clean
git clean -xdf
.PHONY: install run user-install dist macos clean mrproper install-translations
.PHONY: dockindent dockindent-image indent indent-host
.PHONY: install-deeplink uninstall-deeplink
# force qt5 build when QtCreator is installed in user's home
ifeq ($(shell test -x ~/Qt/5.*/clang_64/bin/qmake || echo err),)
QMAKE=~/Qt/5.*/clang_64/bin/qmake
endif
iaito: build
$(MAKE) -C build
build:
mkdir -p build
cd build && $(QMAKE) ../src/Iaito.pro $(QMAKE_FLAGS)
install-man:
mkdir -p "${DESTDIR}${MANDIR}/man1"
for FILE in src/*.1 ; do ${INSTALL_MAN} "$$FILE" "${DESTDIR}${MANDIR}/man1" ; done
install: build
ifeq ($(shell uname),Darwin)
rm -rf $(DESTDIR)/Applications/iaito.app
mkdir -p $(DESTDIR)/Applications
cp -rf build/iaito.app $(DESTDIR)/Applications/iaito.app
mkdir -p $(DESTDIR)/$(PREFIX)/bin
ln -fs '/Applications/iaito.app/Contents/MacOS/iaito' $(DESTDIR)/$(PREFIX)'/bin/iaito'
else
$(MAKE) -C build install INSTALL_ROOT=$(DESTDIR)
# Refresh the desktop DB so the .desktop MimeType registers iaito://
-update-desktop-database "$(DESTDIR)$(PREFIX)/share/applications" 2>/dev/null
endif
$(MAKE) install-man
uninstall:
ifeq ($(shell uname),Darwin)
rm -rf $(DESTDIR)/Applications/iaito.app
rm -rf "$(DESTDIR)/$(PREFIX)/bin/iaito"
else
rm -rf "$(DESTDIR)/$(PREFIX)/share/iaito"
rm -rf "$(DESTDIR)/$(PREFIX)/bin/iaito"
endif
rm -f "${DESTDIR}$(MANDIR)/man1/iaito.1"
-$(MAKE) uninstall-deeplink
user-install: build
ifeq ($(shell uname),Darwin)
rm -rf ${HOME}/Applications/iaito.app
mkdir -p ${HOME}/Applications
cp -rf build/iaito.app ${HOME}/Applications/iaito.app
else
$(MAKE) -C build install INSTALL_ROOT=/ PREFIX=${HOME}/.local
endif
$(MAKE) install-man DESTDIR=/ PREFIX=${HOME}/.local MANDIR=${HOME}/.local/share/man
$(MAKE) install-deeplink
user-uninstall:
$(MAKE) uninstall DESTDIR=/ PREFIX=${HOME}/.local MANDIR=${HOME}/.local/share/man
ifneq ($(shell uname),Darwin)
run: install-desktop-user
endif
run:
rarun2 libpath=$(shell r2 -H R2_LIBDIR) program=$(BIN)
install-desktop-user:
@mkdir -p $(HOME)/.local/share/applications
@mkdir -p $(HOME)/.local/share/icons/hicolor/scalable/apps
@cp -f src/org.radare.iaito.desktop $(HOME)/.local/share/applications/org.radare.iaito.desktop
@cp -f src/img/org.radare.iaito.svg $(HOME)/.local/share/icons/hicolor/scalable/apps/org.radare.iaito.svg
@$(MAKE) install-deeplink
# Register/unregister the iaito:// deep link URI scheme handler
install-deeplink:
ifeq ($(shell uname),Darwin)
sh scripts/deeplink/register.sh "$(DESTDIR)/Applications/iaito.app"
else
sh scripts/deeplink/register.sh
endif
uninstall-deeplink:
sh scripts/deeplink/unregister.sh
gdb:
gdb --args $(BIN)
lldb:
lldb -- $(BIN)
src/translations/README.md:
git clone https://github.com/radareorg/iaito-translations.git src/translations
install-translations: src/translations/README.md
$(MAKE) -C src/translations install PREFIX="$(DESTDIR)/$(PREFIX)"
user-install-translations: src/translations/README.md
$(MAKE) -C src/translations user-install
dockindent:
$(MAKE) dockindent-image
docker run --rm -v "$$PWD:/project" $(INDENT_IMAGE) -i $(INDENT_FILES)
dockindent-image:
docker image inspect $(INDENT_IMAGE) >/dev/null 2>&1 || \
$(MAKE) -C scripts/indent IMAGE_NAME=$(INDENT_IMAGE_NAME) IMAGE_TAG=$(INDENT_IMAGE_TAG)
fmt format indent:
$(MAKE) dockindent
indent-host:
$(CLANG_FORMAT) --version | grep 'version 20.'
$(CLANG_FORMAT) -i $(INDENT_FILES)