From 58b35227b98d8a7de702397a481cc4df05f0edc0 Mon Sep 17 00:00:00 2001 From: joseph calderon Date: Sat, 8 Aug 2026 09:12:42 -0700 Subject: [PATCH 1/2] add support for headless compilation --- docs/src/Submakefile | 2 ++ scripts/linuxcnc.in | 7 +++++ src/Makefile | 38 ++++++++++++++++++++------ src/Makefile.inc.in | 2 ++ src/configure.ac | 44 ++++++++++++++++++++++++++++--- src/emc/usr_intf/Submakefile | 2 ++ src/emc/usr_intf/axis/Submakefile | 5 +++- src/hal/components/Submakefile | 2 ++ src/hal/utils/Submakefile | 6 +++++ 9 files changed, 95 insertions(+), 13 deletions(-) diff --git a/docs/src/Submakefile b/docs/src/Submakefile index e18dcf1dce4..e56dec4a78f 100644 --- a/docs/src/Submakefile +++ b/docs/src/Submakefile @@ -1381,7 +1381,9 @@ clean: endif manpages: $(GENERATED_MANPAGES) +ifeq ($(BUILD_MANPAGES),yes) TARGETS += manpages +endif # make manpages from all the asciidoc manpage-sources GENERATED_MANPAGES += $(patsubst $(DOC_DIR)/src/man/%.adoc, $(DOC_MAN)/%, $(wildcard $(DOC_DIR)/src/man/man?/*.adoc)) diff --git a/scripts/linuxcnc.in b/scripts/linuxcnc.in index 39b7718e2b4..3ab645da498 100644 --- a/scripts/linuxcnc.in +++ b/scripts/linuxcnc.in @@ -987,8 +987,15 @@ case $EMCDISPLAY in echo "DUMMY DISPLAY MODULE, press to continue." read -r ; ;; + linuxcncrsh) + if ! program_available "$EMCDISPLAY"; then + echo "Can't execute DISPLAY program $EMCDISPLAY ${EMCDISPLAYARGS[*]} ${EXTRA_ARGS[*]}" + Cleanup + exit 1 + fi $EMCDISPLAY "${EMCDISPLAYARGS[@]}" "${EXTRA_ARGS[@]}" -- -ini "$INIFILE" + result=$? ;; *) # all other displays are assumed to be commands on the PATH diff --git a/src/Makefile b/src/Makefile index f43362f943b..d3bb823d4d0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -169,6 +169,12 @@ PYTARGETS := GENERATED_MANPAGES := # Submakefiles from each of these directories will be included if they exist +ifeq ($(BUILD_GUI),yes) +GUI_SUBDIRS := emc/usr_intf/axis emc/usr_intf/touchy emc/usr_intf/stepconf emc/usr_intf/pncconf \ + emc/usr_intf/gremlin emc/usr_intf/gscreen emc/usr_intf/pyui emc/usr_intf/qtvcp \ + emc/usr_intf/gmoccapy emc/usr_intf/qtplasmac emc/usr_intf/mdro +endif + SUBDIRS := \ libnml/linklist libnml/cms libnml/rcs libnml/os_intf \ libnml/nml libnml/buffer libnml/posemath libnml \ @@ -184,9 +190,7 @@ SUBDIRS := \ hal/user_comps/huanyang-vfd \ hal/user_comps/xhc-whb04b-6 \ \ - emc/usr_intf/axis emc/usr_intf/touchy emc/usr_intf/stepconf emc/usr_intf/pncconf \ - emc/usr_intf/gremlin emc/usr_intf/gscreen emc/usr_intf/pyui emc/usr_intf/qtvcp \ - emc/usr_intf/gmoccapy emc/usr_intf/qtplasmac emc/usr_intf/mdro\ + $(GUI_SUBDIRS) \ emc/usr_intf emc/nml_intf emc/task emc/kinematics emc/tp emc/canterp \ emc/motion emc/ini emc/rs274ngc emc/sai emc/pythonplugin \ emc/motion-logger \ @@ -482,7 +486,9 @@ TARGETS += ../bin/gremlin_view $(Q)chmod +x $@ # halshow as standalone app: +ifeq ($(BUILD_GUI),yes) TARGETS += ../bin/halshow +endif ../bin/halshow: Makefile $(Q)rm -f $@ $(Q)(echo "#!$(TCLSH)")>|$@ @@ -681,9 +687,11 @@ install-dirs: $(DESTDIR)$(datadir)/linuxcnc/hallib install-kernel-indep: install-dirs - $(FILE) ../docs/build/man/man1/*.1 $(DESTDIR)$(mandir)/man1 +ifeq ($(BUILD_MANPAGES),yes) + $(FILE) $(wildcard ../docs/build/man/man1/*.1) $(DESTDIR)$(mandir)/man1 $(FILE) $(wildcard ../docs/build/man/man3/*.3) $(DESTDIR)$(mandir)/man3 $(FILE) $(wildcard ../docs/build/man/man9/*.9) $(DESTDIR)$(mandir)/man9 +endif $(FILE) objects/*.msg $(DESTDIR)$(tcldir)/msgs $(EXE) ../scripts/realtime $(DESTDIR)$(prefix)/lib/linuxcnc $(EXE) ../scripts/halrun $(DESTDIR)$(bindir) @@ -727,12 +735,15 @@ install-kernel-indep: install-dirs $(FILE) ../tcl/TkLinuxCNC $(DESTDIR)/etc/X11/app-defaults $(FILE) Makefile.modinc $(DESTDIR)$(datadir)/linuxcnc $(EXE) $(TCL) $(DESTDIR)$(tcldir) +ifeq ($(BUILD_GUI),yes) $(FILE) ../tcl/hal.so $(DESTDIR)$(tcldir) $(FILE) ../tcl/linuxcnc.so $(DESTDIR)$(tcldir) +endif $(FILE) ../tcl/pkgIndex.tcl $(DESTDIR)$(tcldir) $(EXE) $(TCL_BIN) $(DESTDIR)$(tcldir)/bin $(FILE) ../tcl/scripts/balloon.tcl ../tcl/scripts/emchelp.tcl $(DESTDIR)$(tcldir)/scripts $(EXE) ../tcl/scripts/Set_Coordinates.tcl $(DESTDIR)$(tcldir)/scripts +ifeq ($(BUILD_GUI),yes) $(FILE) ../share/linuxcnc/*.glade $(DESTDIR)$(prefix)/share/linuxcnc $(FILE) ../share/linuxcnc/stepconf/*.glade $(DESTDIR)$(prefix)/share/linuxcnc/stepconf $(FILE) ../share/linuxcnc/touchy.glade $(DESTDIR)$(prefix)/share/linuxcnc @@ -742,8 +753,10 @@ install-kernel-indep: install-dirs $(FILE) ../share/linuxcnc/pncconf/*.glade $(DESTDIR)$(prefix)/share/linuxcnc/pncconf $(FILE) ../share/linuxcnc/gremlin_view.ui $(DESTDIR)$(prefix)/share/linuxcnc $(FILE) ../share/linuxcnc/popupkeyboard.ui $(DESTDIR)$(prefix)/share/linuxcnc +endif $(FILE) ../configs/common/linuxcnc.nml $(DESTDIR)$(prefix)/share/linuxcnc $(FILE) ../configs/common/linuxcnc_big.nml $(DESTDIR)$(prefix)/share/linuxcnc +ifeq ($(BUILD_GUI),yes) $(FILE) ../src/emc/usr_intf/pncconf/pncconf-help/*.txt $(DESTDIR)$(prefix)/share/linuxcnc/pncconf/pncconf-help $(FILE) ../src/emc/usr_intf/pncconf/pncconf-help/*.png $(DESTDIR)$(prefix)/share/linuxcnc/pncconf/pncconf-help @@ -751,6 +764,7 @@ install-kernel-indep: install-dirs $(FILE) ../share/glade/pixmaps/hicolor/22x22/actions/widget*.png $(DESTDIR)$(datadir)/glade/pixmaps/hicolor/22x22/actions/ $(FILE) ../share/gtksourceview-4/language-specs/*.lang $(DESTDIR)$(datadir)/gtksourceview-4/language-specs/ +endif $(FILE) ../src/hal/drivers/mesa-hostmot2/modbus/*.tmpl $(DESTDIR)$(prefix)/share/linuxcnc/ @@ -758,6 +772,7 @@ install-kernel-indep: install-python install-python: install-dirs $(DIR) $(DESTDIR)$(SITEPY) $(DESTDIR)$(SITEPY)/rs274 $(DIR) $(DESTDIR)$(SITEPY)/common +ifeq ($(BUILD_GUI),yes) $(DIR) $(DESTDIR)$(SITEPY)/touchy $(DIR) $(DESTDIR)$(SITEPY)/gscreen $(DIR) $(DESTDIR)$(SITEPY)/qtvcp @@ -779,9 +794,11 @@ install-python: install-dirs $(DIR) $(DESTDIR)$(SITEPY)/pncconf $(DIR) $(DESTDIR)$(SITEPY)/pyui $(DIR) $(DESTDIR)$(SITEPY)/plasmac +endif $(FILE) ../lib/python/*.py ../lib/python/*.so $(DESTDIR)$(SITEPY) $(FILE) ../lib/python/common/*.py $(DESTDIR)$(SITEPY)/common $(FILE) ../lib/python/rs274/*.py $(DESTDIR)$(SITEPY)/rs274 +ifeq ($(BUILD_GUI),yes) $(FILE) ../lib/python/touchy/*.py $(DESTDIR)$(SITEPY)/touchy $(FILE) ../lib/python/gscreen/*.py $(DESTDIR)$(SITEPY)/gscreen $(FILE) ../lib/python/qtvcp/*.{py,ui,txt} $(DESTDIR)$(SITEPY)/qtvcp @@ -799,6 +816,7 @@ install-python: install-dirs $(EXE) ../bin/stepconf $(DESTDIR)$(bindir) $(EXE) ../bin/pncconf $(DESTDIR)$(bindir) $(EXE) ../bin/pyui $(DESTDIR)$(bindir) +endif $(EXE) ../bin/hal_input $(DESTDIR)$(bindir) $(EXE) ../bin/hal_bridge $(DESTDIR)$(bindir) $(EXE) ../bin/mitsub_vfd $(DESTDIR)$(bindir) @@ -806,14 +824,15 @@ install-python: install-dirs $(EXE) ../bin/z_level_compensation $(DESTDIR)$(bindir) $(EXE) ../bin/pmx485 $(DESTDIR)$(bindir) $(EXE) ../bin/sim-torch $(DESTDIR)$(bindir) - $(EXE) ../bin/pyvcp $(DESTDIR)$(bindir) - $(EXE) ../bin/gladevcp $(DESTDIR)$(bindir) - $(EXE) ../bin/axis $(DESTDIR)$(bindir) $(EXE) ../bin/axis-remote $(DESTDIR)$(bindir) $(EXE) ../bin/debuglevel $(DESTDIR)$(bindir) $(EXE) ../bin/linuxcnctop $(DESTDIR)$(bindir) $(EXE) ../bin/mdi $(DESTDIR)$(bindir) $(EXE) ../bin/hal_manualtoolchange $(DESTDIR)$(bindir) +ifeq ($(BUILD_GUI),yes) + $(EXE) ../bin/pyvcp $(DESTDIR)$(bindir) + $(EXE) ../bin/gladevcp $(DESTDIR)$(bindir) + $(EXE) ../bin/axis $(DESTDIR)$(bindir) $(EXE) ../bin/image-to-gcode $(DESTDIR)$(bindir) $(EXE) ../bin/touchy $(DESTDIR)$(bindir) $(EXE) ../bin/gscreen $(DESTDIR)$(bindir) @@ -821,12 +840,14 @@ install-python: install-dirs $(EXE) ../lib/python/qtvcp/designer/install_script $(DESTDIR)$(SITEPY)/qtvcp/designer/ $(EXE) ../bin/gmoccapy $(DESTDIR)$(bindir) $(EXE) ../bin/teach-in $(DESTDIR)$(bindir) - $(EXE) ../bin/scorbot-er-3 $(DESTDIR)$(bindir) $(EXE) $(patsubst %.py,../bin/%,$(VISMACH_PY)) $(DESTDIR)$(bindir) $(EXE) $(patsubst %.py,../bin/%,$(QTPLASMAC_PY)) $(DESTDIR)$(bindir) $(FILE) ../share/linuxcnc/linuxcnc-wizard.gif $(DESTDIR)$(prefix)/share/linuxcnc $(FILE) ../share/axis/images/*.{png,gif,xbm,ngc} $(DESTDIR)$(datadir)/axis/images $(FILE) ../share/axis/tcl/*.tcl $(DESTDIR)$(datadir)/axis/tcl +endif + $(EXE) ../bin/scorbot-er-3 $(DESTDIR)$(bindir) +ifeq ($(BUILD_GUI),yes) $(FILE) ../share/gscreen/images/*.gif $(DESTDIR)$(datadir)/gscreen/images $(TREE) ../share/gscreen/skins/* $(DESTDIR)$(datadir)/gscreen/skins $(TREE) ../share/qtvcp/images/* $(DESTDIR)$(datadir)/qtvcp/images @@ -834,6 +855,7 @@ install-python: install-dirs $(TREE) ../share/qtvcp/panels/* $(DESTDIR)$(datadir)/qtvcp/panels $(TREE) ../share/qtvcp/widgets_ui/* $(DESTDIR)$(datadir)/qtvcp/widgets_ui $(TREE) ../share/gmoccapy/icons/* $(DESTDIR)$(datadir)/gmoccapy/icons +endif install-kernel-dep: $(DIR) $(DESTDIR)$(moduledir)/linuxcnc \ diff --git a/src/Makefile.inc.in b/src/Makefile.inc.in index 8e9447d5781..c0ab1ceb631 100644 --- a/src/Makefile.inc.in +++ b/src/Makefile.inc.in @@ -80,6 +80,7 @@ RTFLAGS := -I. -I@RTDIR@/include $(RTFLAGS) -DRTAPI -D_GNU_SOURCE -Drealtime ULFLAGS = -Wall -g -I. -I@RTDIR@/include -DULAPI -D_GNU_SOURCE -O2 -DLOCALE_DIR=\"$(localedir)\" -DPACKAGE=\"$(package)\" MODULE_EXT = @MODEXT@ BUILD_SYS = @BUILD_SYS@ +BUILD_GUI = @BUILD_GUI@ CC = @CC@ MANDB = @MANDB@ HIDRAW_H_USABLE = @HIDRAW_H_USABLE@ @@ -123,6 +124,7 @@ XGETTEXT = @XGETTEXT@ LIBDL = @LIBDL@ YAPPS = @YAPPS@ +BUILD_MANPAGES = @BUILD_MANPAGES@ BUILD_DOCS = @BUILD_DOCS@ BUILD_DOCS_PDF = @BUILD_DOCS_PDF@ BUILD_DOCS_HTML = @BUILD_DOCS_HTML@ diff --git a/src/configure.ac b/src/configure.ac index 03bf65e37e1..6985220c946 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -696,7 +696,11 @@ AC_ARG_WITH([tcl-dir], [EMC2_TCL_DIR="$withval"], [TCL_GET_DIR=$(echo [['set d [lindex [lsearch -all -inline -glob $tcl_pkgPath /usr/share/*] 0]; if {$d eq ""} {set d [lindex [lsearch -all -inline -glob $tcl_pkgPath /usr/lib*] 0]}; puts $d']] | tclsh 2>/dev/null) AS_IF([test -z "$TCL_GET_DIR"], - [AC_MSG_ERROR([could not determine Tcl package dir from tcl_pkgPath])]) + [ + if test "$BUILD_GUI" = "yes"; then + AC_MSG_ERROR([could not determine Tcl package dir from tcl_pkgPath]) + fi + ]) EMC2_TCL_DIR="$TCL_GET_DIR/linuxcnc"]) fe () { @@ -810,6 +814,15 @@ else fi +AC_ARG_ENABLE(gui, + AS_HELP_STRING([--disable-gui], [Disable building graphical user interfaces (Tk, Tcl, X11, Xinerama, GTK)]), + [BUILD_GUI=$enableval], + [BUILD_GUI=yes]) +if test "$BUILD_GUI" = "no"; then + BUILD_GTK=no +fi +AC_SUBST([BUILD_GUI]) + AC_ARG_ENABLE(gtk, AS_HELP_STRING( [--disable-gtk], @@ -937,7 +950,7 @@ AC_SUBST(YAPPS) AC_PATH_PROG(MANDB, mandb, "") AC_PATH_PROG(INTLTOOL_EXTRACT, intltool-extract, "none", $SPATH) -if test $INTLTOOL_EXTRACT = "none" +if test "$INTLTOOL_EXTRACT" = "none" then AC_MSG_ERROR([intltool-extract not found]) fi @@ -1075,12 +1088,22 @@ AC_ARG_ENABLE(build-documentation, # --enable-build-documentation=html). =html itself warn-and-disables # only the missing PDF tools; users who want PDF best-effort can pass # =html and rebuild after installing the missing tools. +AC_ARG_ENABLE(manpages, + [ --disable-manpages Disable building man pages], + [BUILD_MANPAGES=$enableval], + [BUILD_MANPAGES=yes]) +AC_SUBST([BUILD_MANPAGES]) + # halcompile manpages need asciidoctor regardless of BUILD_DOCS. AC_PATH_PROG(ASCIIDOCTOR,asciidoctor,"none") if ( test "none" = "$ASCIIDOCTOR" ) ; then - AC_MSG_ERROR([no asciidoctor, manpages cannot be built + if ( test "x$BUILD_MANPAGES" = "xyes" ) ; then + AC_MSG_ERROR([no asciidoctor, manpages cannot be built install with "sudo apt-get install asciidoctor" on Debian / Ubuntu, "sudo dnf install rubygem-asciidoctor" on Fedora, or "gem install asciidoctor"]) + else + AC_MSG_NOTICE([asciidoctor not found, bypassing manpage build...]) + fi fi if ( test "$BUILD_DOCS" = "yes" ) ; then @@ -1362,6 +1385,8 @@ AH_BOTTOM(#endif # so testing is done by finding tclConfig.sh and tkConfig.sh # # if the search fails the traditional check is done # ############################################################################## +if test "$BUILD_GUI" = "yes"; then + AC_MSG_CHECKING([for tcl]) AC_ARG_WITH(tclConfig, @@ -1518,6 +1543,11 @@ install with "sudo apt-get install python3-gi"]) fi fi +else + TCLSH=tclsh + WISH=wish +fi + AC_SUBST([TCL_DBGX]) AC_SUBST([TK_DBGX]) AC_SUBST([TCL_CFLAGS]) @@ -1553,7 +1583,9 @@ AC_CHECK_LIB(Xinerama, XineramaQueryExtension, [HAVE_XINERAMA=no]) if test "x$HAVE_XINERAMA" = "xno"; then - AC_MSG_ERROR([Xinerama library or headers not found]) + if test "$BUILD_GUI" = "yes"; then + AC_MSG_ERROR([Xinerama library or headers not found]) + fi fi #clean out LIBS @@ -1657,6 +1689,7 @@ then fi AC_MSG_RESULT(OK) +if test "$BUILD_GUI" = "yes"; then AC_MSG_CHECKING([match between tk and Tkinter versions]) if $PYTHON -c 'import sys;raise SystemExit(sys.hexversion<0x3040000)' then @@ -1681,11 +1714,13 @@ if test "$PYTHON_TK_VERSION" != "$TK_VERSION"; then AC_MSG_ERROR(["Python requires use of Tk $TK_VERSION. Install this version and specify --with-tkConfig if necessary"]) fi AC_MSG_RESULT([$PYTHON_TK_VERSION]) +fi AC_MSG_CHECKING(for site-package location) SITEPY=`$PYTHON -c "import sysconfig; s=sysconfig.get_scheme_names(); print(sysconfig.get_path('platlib', 'deb_system' if 'deb_system' in s else 'rpm_prefix' if 'rpm_prefix' in s else sysconfig.get_default_scheme()))"` AC_MSG_RESULT($SITEPY) +if test "$BUILD_GUI" = "yes"; then AC_MSG_CHECKING(for working GLU quadrics) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include @@ -1697,6 +1732,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_MSG_CHECKING(for Xmu headers) AC_CHECK_HEADERS(X11/Xmu/Xmu.h,[],[AC_MSG_ERROR([Required Xmu header missing. Install it, or specify --disable-python to skip the parts of LinuxCNC that depend on Python])]) +fi AC_SUBST([LIBPYTHON]) AC_SUBST([SITEPY]) diff --git a/src/emc/usr_intf/Submakefile b/src/emc/usr_intf/Submakefile index b914e30ffe1..cb99070ff44 100644 --- a/src/emc/usr_intf/Submakefile +++ b/src/emc/usr_intf/Submakefile @@ -23,7 +23,9 @@ $(call TOOBJSDEPS, $(EMCSHSRCS)) : EXTRAFLAGS = $(ULFLAGS) $(TCL_CFLAGS) -fPIC ../tcl/linuxcnc.so: $(call TOOBJS, $(EMCSHSRCS)) ../lib/liblinuxcnc.a ../lib/liblinuxcncini.so.1 ../lib/libnml.so.0 $(ECHO) Linking $(notdir $@) $(Q)$(CXX) -shared $(LDFLAGS) -o $@ $(ULFLAGS) $(TCL_CFLAGS) $^ $(TCL_LIBS) -lXinerama +ifeq ($(BUILD_GUI),yes) TARGETS += ../tcl/linuxcnc.so +endif ../bin/linuxcncrsh: $(call TOOBJS, $(EMCRSHSRCS)) ../lib/liblinuxcnchal.so.0 ../lib/liblinuxcnc.a ../lib/libnml.so.0 ../lib/liblinuxcncini.so.1 $(ECHO) Linking $(notdir $@) diff --git a/src/emc/usr_intf/axis/Submakefile b/src/emc/usr_intf/axis/Submakefile index 3b294a2c91e..91ee542d4bf 100644 --- a/src/emc/usr_intf/axis/Submakefile +++ b/src/emc/usr_intf/axis/Submakefile @@ -27,7 +27,10 @@ $(TKDARMODULE): $(call TOOBJS, $(TKDARMODULESRCS)) $(ECHO) Linking python module $(notdir $@) $(Q)$(CC) $(LDFLAGS) -shared -o $@ $(TCL_CFLAGS) $^ -lX11 $(TCL_LIBS) -PYTARGETS += $(EMCMODULE) $(TOGLMODULE) $(TKDARMODULE) +PYTARGETS += $(EMCMODULE) +ifeq ($(BUILD_GUI),yes) +PYTARGETS += $(TOGLMODULE) $(TKDARMODULE) +endif PYSCRIPTS := axis.py axis-remote.py linuxcnctop.py hal_manualtoolchange.py \ mdi.py image-to-gcode.py lintini.py debuglevel.py teach-in.py tracking-test.py diff --git a/src/hal/components/Submakefile b/src/hal/components/Submakefile index d00728e0487..62c9940cfbb 100644 --- a/src/hal/components/Submakefile +++ b/src/hal/components/Submakefile @@ -42,7 +42,9 @@ else COMP_DRIVERS := $(wildcard hal/drivers/*.comp) endif COMP_DRIVER_MANPAGES := $(patsubst hal/drivers/%.comp, ../docs/build/man/man9/%.9, $(COMP_DRIVERS)) +ifeq ($(BUILD_MANPAGES),yes) TARGETS += manpages +endif GENERATED_MANPAGES += $(COMP_MANPAGES) GENERATED_MANPAGES += $(COMP_DRIVER_MANPAGES) .PHONY: manpages diff --git a/src/hal/utils/Submakefile b/src/hal/utils/Submakefile index 69d17f766e1..dba6785e546 100644 --- a/src/hal/utils/Submakefile +++ b/src/hal/utils/Submakefile @@ -13,14 +13,20 @@ HALSHSRCS := \ ifneq ($(READLINE_LIBS),) HALCMDSRCS += hal/utils/halcmd_completion.c endif +ifeq ($(BUILD_GUI),yes) USERSRCS += $(sort $(HALCMDSRCS) $(HALSHSRCS)) +else +USERSRCS += $(sort $(HALCMDSRCS)) +endif $(call TOOBJSDEPS, $(HALSHSRCS)) : EXTRAFLAGS = -fPIC $(call TOOBJSDEPS, hal/utils/halsh.c) : EXTRAFLAGS += $(TCL_CFLAGS) ../tcl/hal.so: $(call TOOBJS, $(HALSHSRCS)) ../lib/liblinuxcncini.so.1 ../lib/liblinuxcnchal.so.0 $(ECHO) Linking $(notdir $@) $(Q)$(CXX) $(LDFLAGS) -shared $^ $(TCL_LIBS) -o $@ -lfmt +ifeq ($(BUILD_GUI),yes) TARGETS += ../tcl/hal.so +endif ../bin/halcmd: $(call TOOBJS, $(HALCMDSRCS)) ../lib/liblinuxcncini.so.1 ../lib/liblinuxcnchal.so.0 $(ECHO) Linking $(notdir $@) From 2f0e02abd849e2a67517da8707cf80319d820ccb Mon Sep 17 00:00:00 2001 From: joseph calderon Date: Tue, 11 Aug 2026 07:15:55 -0700 Subject: [PATCH 2/2] address pr code review feedback --- src/Makefile | 18 +++++++++++------- src/configure.ac | 9 ++++----- src/emc/usr_intf/axis/Submakefile | 9 +++++++-- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/Makefile b/src/Makefile index d3bb823d4d0..179923279ce 100644 --- a/src/Makefile +++ b/src/Makefile @@ -170,7 +170,7 @@ GENERATED_MANPAGES := # Submakefiles from each of these directories will be included if they exist ifeq ($(BUILD_GUI),yes) -GUI_SUBDIRS := emc/usr_intf/axis emc/usr_intf/touchy emc/usr_intf/stepconf emc/usr_intf/pncconf \ +GUI_SUBDIRS := emc/usr_intf/touchy emc/usr_intf/stepconf emc/usr_intf/pncconf \ emc/usr_intf/gremlin emc/usr_intf/gscreen emc/usr_intf/pyui emc/usr_intf/qtvcp \ emc/usr_intf/gmoccapy emc/usr_intf/qtplasmac emc/usr_intf/mdro endif @@ -191,7 +191,7 @@ SUBDIRS := \ hal/user_comps/xhc-whb04b-6 \ \ $(GUI_SUBDIRS) \ - emc/usr_intf emc/nml_intf emc/task emc/kinematics emc/tp emc/canterp \ + emc/usr_intf/axis emc/usr_intf emc/nml_intf emc/task emc/kinematics emc/tp emc/canterp \ emc/motion emc/ini emc/rs274ngc emc/sai emc/pythonplugin \ emc/motion-logger \ emc/tooldata \ @@ -692,7 +692,9 @@ ifeq ($(BUILD_MANPAGES),yes) $(FILE) $(wildcard ../docs/build/man/man3/*.3) $(DESTDIR)$(mandir)/man3 $(FILE) $(wildcard ../docs/build/man/man9/*.9) $(DESTDIR)$(mandir)/man9 endif +ifeq ($(BUILD_GUI),yes) $(FILE) objects/*.msg $(DESTDIR)$(tcldir)/msgs +endif $(EXE) ../scripts/realtime $(DESTDIR)$(prefix)/lib/linuxcnc $(EXE) ../scripts/halrun $(DESTDIR)$(bindir) $(EXE) ../scripts/halcmd_twopass $(DESTDIR)$(bindir) @@ -701,7 +703,9 @@ endif $(EXE) ../scripts/sim_pin $(DESTDIR)$(bindir) $(FILE) ../*.png ../*.gif $(DESTDIR)$(datadir)/linuxcnc $(FILE) ../lib/hallib/* $(DESTDIR)$(datadir)/linuxcnc/hallib +ifeq ($(BUILD_GUI),yes) $(FILE) ../tcl/*.png $(DESTDIR)$(tcldir) +endif # install all the sample configs, including subdirs (tar is required on debian systems, and common on others) $(DIR) $(DESTDIR)$(sampleconfsdir) @@ -732,17 +736,17 @@ endif $(FILE) $(HEADERS) $(DESTDIR)$(includedir)/linuxcnc/ $(TREE) $(NC_FILES) $(DESTDIR)$(ncfilesdir) $(EXE) ../nc_files/M101 $(DESTDIR)$(ncfilesdir) - $(FILE) ../tcl/TkLinuxCNC $(DESTDIR)/etc/X11/app-defaults $(FILE) Makefile.modinc $(DESTDIR)$(datadir)/linuxcnc - $(EXE) $(TCL) $(DESTDIR)$(tcldir) ifeq ($(BUILD_GUI),yes) + $(EXE) $(TCL) $(DESTDIR)$(tcldir) + $(FILE) ../tcl/TkLinuxCNC $(DESTDIR)/etc/X11/app-defaults $(FILE) ../tcl/hal.so $(DESTDIR)$(tcldir) $(FILE) ../tcl/linuxcnc.so $(DESTDIR)$(tcldir) -endif $(FILE) ../tcl/pkgIndex.tcl $(DESTDIR)$(tcldir) $(EXE) $(TCL_BIN) $(DESTDIR)$(tcldir)/bin $(FILE) ../tcl/scripts/balloon.tcl ../tcl/scripts/emchelp.tcl $(DESTDIR)$(tcldir)/scripts $(EXE) ../tcl/scripts/Set_Coordinates.tcl $(DESTDIR)$(tcldir)/scripts +endif ifeq ($(BUILD_GUI),yes) $(FILE) ../share/linuxcnc/*.glade $(DESTDIR)$(prefix)/share/linuxcnc $(FILE) ../share/linuxcnc/stepconf/*.glade $(DESTDIR)$(prefix)/share/linuxcnc/stepconf @@ -824,12 +828,12 @@ endif $(EXE) ../bin/z_level_compensation $(DESTDIR)$(bindir) $(EXE) ../bin/pmx485 $(DESTDIR)$(bindir) $(EXE) ../bin/sim-torch $(DESTDIR)$(bindir) - $(EXE) ../bin/axis-remote $(DESTDIR)$(bindir) $(EXE) ../bin/debuglevel $(DESTDIR)$(bindir) $(EXE) ../bin/linuxcnctop $(DESTDIR)$(bindir) $(EXE) ../bin/mdi $(DESTDIR)$(bindir) - $(EXE) ../bin/hal_manualtoolchange $(DESTDIR)$(bindir) ifeq ($(BUILD_GUI),yes) + $(EXE) ../bin/hal_manualtoolchange $(DESTDIR)$(bindir) + $(EXE) ../bin/axis-remote $(DESTDIR)$(bindir) $(EXE) ../bin/pyvcp $(DESTDIR)$(bindir) $(EXE) ../bin/gladevcp $(DESTDIR)$(bindir) $(EXE) ../bin/axis $(DESTDIR)$(bindir) diff --git a/src/configure.ac b/src/configure.ac index 6985220c946..7e6458227d9 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -699,6 +699,8 @@ AC_ARG_WITH([tcl-dir], [ if test "$BUILD_GUI" = "yes"; then AC_MSG_ERROR([could not determine Tcl package dir from tcl_pkgPath]) + else + TCL_GET_DIR="${libdir}/tcltk" fi ]) EMC2_TCL_DIR="$TCL_GET_DIR/linuxcnc"]) @@ -818,9 +820,6 @@ AC_ARG_ENABLE(gui, AS_HELP_STRING([--disable-gui], [Disable building graphical user interfaces (Tk, Tcl, X11, Xinerama, GTK)]), [BUILD_GUI=$enableval], [BUILD_GUI=yes]) -if test "$BUILD_GUI" = "no"; then - BUILD_GTK=no -fi AC_SUBST([BUILD_GUI]) AC_ARG_ENABLE(gtk, @@ -836,7 +835,7 @@ AC_ARG_ENABLE(gtk, BUILD_GTK=no ;; esac ], - [BUILD_GTK=yes]) + [BUILD_GTK=$BUILD_GUI]) if test "$BUILD_GTK" = "yes"; then AC_MSG_CHECKING([for GTK 3.22.4 or above]) @@ -1089,7 +1088,7 @@ AC_ARG_ENABLE(build-documentation, # only the missing PDF tools; users who want PDF best-effort can pass # =html and rebuild after installing the missing tools. AC_ARG_ENABLE(manpages, - [ --disable-manpages Disable building man pages], + AS_HELP_STRING([--disable-manpages], [Disable building man pages]), [BUILD_MANPAGES=$enableval], [BUILD_MANPAGES=yes]) AC_SUBST([BUILD_MANPAGES]) diff --git a/src/emc/usr_intf/axis/Submakefile b/src/emc/usr_intf/axis/Submakefile index 91ee542d4bf..f58a18a2e51 100644 --- a/src/emc/usr_intf/axis/Submakefile +++ b/src/emc/usr_intf/axis/Submakefile @@ -32,8 +32,13 @@ ifeq ($(BUILD_GUI),yes) PYTARGETS += $(TOGLMODULE) $(TKDARMODULE) endif -PYSCRIPTS := axis.py axis-remote.py linuxcnctop.py hal_manualtoolchange.py \ +ALL_PYSCRIPTS := axis.py axis-remote.py linuxcnctop.py hal_manualtoolchange.py \ mdi.py image-to-gcode.py lintini.py debuglevel.py teach-in.py tracking-test.py + +PYSCRIPTS := linuxcnctop.py mdi.py lintini.py debuglevel.py tracking-test.py +ifeq ($(BUILD_GUI),yes) +PYSCRIPTS += axis.py axis-remote.py hal_manualtoolchange.py image-to-gcode.py teach-in.py +endif PYBIN := $(patsubst %.py,../bin/%,$(PYSCRIPTS)) PYTARGETS += $(PYBIN) @@ -44,6 +49,6 @@ $(PYBIN): ../bin/%: emc/usr_intf/axis/scripts/%.py $(ECHO) Copying python script $(notdir $@) $(Q)(echo '#!$(PYTHON)'; sed '1 { /^#!/d; }' $<) > $@.tmp && chmod +x $@.tmp && mv -f $@.tmp $@ -PYI18NSRCS += $(addprefix emc/usr_intf/axis/scripts/, $(PYSCRIPTS)) \ +PYI18NSRCS += $(addprefix emc/usr_intf/axis/scripts/, $(ALL_PYSCRIPTS)) \ ../lib/python/propertywindow.py \ ../share/axis/tcl/axis.tcl