From abf47feca16287f5380f129c4ddea0f2a5278d38 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 10 Nov 2018 14:46:23 +0100 Subject: Makefile: drop intermediate NX version vars --- Makefile | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 9213dda9c..ffd6322da 100644 --- a/Makefile +++ b/Makefile @@ -50,11 +50,6 @@ endif IMAKE_DEFINES ?= -NX_VERSION_MAJOR=$(shell ./version.sh 1) -NX_VERSION_MINOR=$(shell ./version.sh 2) -NX_VERSION_MICRO=$(shell ./version.sh 3) -NX_VERSION_PATCH=$(shell ./version.sh 4) - SHELL:=/bin/bash NX_X11_HEADERS = \ @@ -106,10 +101,10 @@ test: version: # prepare nx-X11/config/cf/nxversion.def sed \ - -e 's/###NX_VERSION_MAJOR###/$(NX_VERSION_MAJOR)/' \ - -e 's/###NX_VERSION_MINOR###/$(NX_VERSION_MINOR)/' \ - -e 's/###NX_VERSION_MICRO###/$(NX_VERSION_MICRO)/' \ - -e 's/###NX_VERSION_PATCH###/$(NX_VERSION_PATCH)/' \ + -e 's/###NX_VERSION_MAJOR###/$(shell ./version.sh 1)/' \ + -e 's/###NX_VERSION_MINOR###/$(shell ./version.sh 2)/' \ + -e 's/###NX_VERSION_MICRO###/$(shell ./version.sh 3)/' \ + -e 's/###NX_VERSION_PATCH###/$(shell ./version.sh 4)/' \ nx-X11/config/cf/nxversion.def.in \ > nx-X11/config/cf/nxversion.def -- cgit v1.2.3 From 77b3923129b2fd99f9c2232022a7a1ff438233fb Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 10 Nov 2018 14:48:52 +0100 Subject: Makefile: Rework handling auto-determined values for imake create a new def file nxconfig.def and be fine. The settings in that file will be respected by all subsequent imake calls anywhere in the tree. --- Makefile | 49 ++++++++++++++++++++++++------------------------ nx-X11/config/cf/xorg.cf | 2 ++ 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index ffd6322da..f93fb28e3 100644 --- a/Makefile +++ b/Makefile @@ -25,27 +25,9 @@ USRLIBDIR ?= $(NXLIBDIR)/X11 INCLUDEDIR ?= $(PREFIX)/include CONFIGURE ?= ./configure --prefix="$(PREFIX)" -# use Xfont2 if available in the build env -FONT_DEFINES ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-DHAS_XFONT2") $(shell pkg-config --exists 'xfont < 1.4.2' 1>/dev/null 2>/dev/null && echo "-DLEGACY_XFONT1") -XFONTLIB ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-lXfont2" || echo "-lXfont") -IMAKE_FONT_DEFINES ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-DHasXfont2=YES" || echo "-DHasXfont2=NO") - -# Support older libXext versions. -XEXT_EXTRA_DEFINES ?= $(shell pkg-config --exists 'xextproto < 7.1.0' 1>/dev/null 2>/dev/null && echo "-DLEGACY_XEXT_PROTO") - # check if the xkbcomp devel pkg is available - we need it for the next step -HAS_XKBCOMP_DEVEL="yes" ifneq ($(shell pkg-config --exists xkbcomp && echo yes), yes) - $(warning xkbcomp devel package missing, using default values) - HAS_XKBCOMP_DEVEL="no" -endif - -# the system's directory with the xkb data files (this needs to be -# independent of Imake's ProjectRoot or the configure prefix.) -ifeq ($(HAS_XKBCOMP_DEVEL),yes) -XKB_SYS_DEFINES ?= -DSystemXkbConfigDir=$(shell pkg-config xkbcomp --variable=xkbconfigdir) -DSystemXkbBinDir=$(shell pkg-config xkbcomp --variable=prefix)/bin -else -XKB_SYS_DEFINES ?= -DSystemXkbConfigDir=/usr/share/X11/xkb -DSystemXkbBinDir=/usr/bin + $(warning xkbcomp devel package missing, using imake default values) endif IMAKE_DEFINES ?= @@ -94,6 +76,7 @@ distclean: clean if [ -x ./mesa-quilt ]; then ./mesa-quilt pop -a; fi rm -Rf nx-X11/extras/Mesa/.pc/ rm -f nx-X11/config/cf/nxversion.def + rm -f nx-X11/config/cf/nxconfig.def test: echo "No testing for NX (redistributed)" @@ -108,9 +91,27 @@ version: nx-X11/config/cf/nxversion.def.in \ > nx-X11/config/cf/nxversion.def -build-env: version +imakeconfig: + # auto-config some setting + + # check if system supports Xfont2 + (echo "#define HasXfont2 `pkg-config --exists xfont2 && echo YES || echo NO`") >nx-X11/config/cf/nxconfig.def + + # check if system has an _old_ release of Xfont1 + (echo "#define HasLegacyXfont1 `pkg-config --exists 'xfont < 1.4.2' && echo YES || echo NO`") >>nx-X11/config/cf/nxconfig.def + + # check if system has an _old_ release of XextProto + (echo "#define HasLegacyXextProto `pkg-config --exists 'xextproto < 7.1.0' && echo YES || echo NO`") >>nx-X11/config/cf/nxconfig.def + + # the system's directory with the xkb data and binary files (these + # needs to be independent of Imake's ProjectRoot or the configure + # prefix.) + (pkg-config --exists xkbcomp && echo "#define SystemXkbConfigDir `pkg-config xkbcomp --variable=xkbconfigdir`"; :) >>nx-X11/config/cf/nxconfig.def + (pkg-config --exists xkbcomp && echo "#define SystemXkbBinDir `pkg-config xkbcomp --variable=prefix`/bin"; :) >>nx-X11/config/cf/nxconfig.def + +build-env: version imakeconfig # prepare Makefiles and the nx-X11 symlinking magic - ${MAKE} -j1 -C nx-X11 BuildIncludes FONT_DEFINES="$(FONT_DEFINES)" XEXT_EXTRA_DEFINES="$(XEXT_EXTRA_DEFINES)" IMAKE_DEFINES="$(IMAKE_DEFINES) $(IMAKE_FONT_DEFINES) $(XKB_SYS_DEFINES)" + ${MAKE} -j1 -C nx-X11 BuildIncludes IMAKE_DEFINES="$(IMAKE_DEFINES)" # set up environment for libNX_X11 build (X11 header files) mkdir -p nx-X11/exports/include/nx-X11/ @@ -135,7 +136,7 @@ clean-env: version [ -d exports/include/nx-X11/Xtrans ] && $(RM_DIR) exports/include/nx-X11/Xtrans/ || : [ -d exports/include/nx-X11/ ] && $(RM_DIR) exports/include/nx-X11/ || : - ${MAKE} -j1 -C nx-X11 clean FONT_DEFINES="$(FONT_DEFINES)" XEXT_EXTRA_DEFINES="$(XEXT_EXTRA_DEFINES)" IMAKE_DEFINES="$(IMAKE_DEFINES) $(IMAKE_FONT_DEFINES) $(XKB_SYS_DEFINES)" + ${MAKE} -j1 -C nx-X11 clean IMAKE_DEFINES="$(IMAKE_DEFINES)" build-lite: cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} @@ -159,8 +160,8 @@ build-full: build-env # build nxagent fourth ./mesa-quilt push -a - ${MAKE} -j1 -C nx-X11 BuildDependsOnly FONT_DEFINES="$(FONT_DEFINES)" XEXT_EXTRA_DEFINES="$(XEXT_EXTRA_DEFINES)" IMAKE_DEFINES="$(IMAKE_DEFINES) $(IMAKE_FONT_DEFINES) $(XKB_SYS_DEFINES)" - ${MAKE} -C nx-X11 World USRLIBDIR="$(USRLIBDIR)" SHLIBDIR="$(SHLIBDIR)" FONT_DEFINES="$(FONT_DEFINES)" XFONTLIB="$(XFONTLIB)" XEXT_EXTRA_DEFINES="$(XEXT_EXTRA_DEFINES)" IMAKE_DEFINES="$(IMAKE_DEFINES) $(IMAKE_FONT_DEFINES) $(XKB_SYS_DEFINES)" + ${MAKE} -j1 -C nx-X11 BuildDependsOnly IMAKE_DEFINES="$(IMAKE_DEFINES)" + ${MAKE} -C nx-X11 World USRLIBDIR="$(USRLIBDIR)" SHLIBDIR="$(SHLIBDIR)" IMAKE_DEFINES="$(IMAKE_DEFINES)" # build nxproxy fifth cd nxproxy && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} diff --git a/nx-X11/config/cf/xorg.cf b/nx-X11/config/cf/xorg.cf index 6f1f43018..337c28751 100644 --- a/nx-X11/config/cf/xorg.cf +++ b/nx-X11/config/cf/xorg.cf @@ -52,6 +52,8 @@ XORG_VERSION_CURRENT = XorgVersion RELEASE_VERSION = ReleaseVersion #if NXAgentServer +#include "nxconfig.def" + #include "nxversion.def" #if !defined(nxVersionString) && \ -- cgit v1.2.3 From 58615f9fc27e49066277ed419f76866711ef4e74 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 10 Nov 2018 14:26:15 +0100 Subject: Makefile: use (more) RM macros --- Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f93fb28e3..9ea14c00e 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ SYMLINK_FILE=ln -f -s # helpers for "clean" and "uninstall" targets RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty +RM_DIR_REC=rm -Rf ETCDIR_NX ?= /etc/nxagent PREFIX ?= /usr/local @@ -74,9 +75,9 @@ distclean: clean if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad distclean; fi if test -d nx-X11; then ${MAKE} -C nx-X11 distclean; fi if [ -x ./mesa-quilt ]; then ./mesa-quilt pop -a; fi - rm -Rf nx-X11/extras/Mesa/.pc/ - rm -f nx-X11/config/cf/nxversion.def - rm -f nx-X11/config/cf/nxconfig.def + $(RM_DIR_REC) nx-X11/extras/Mesa/.pc/ + $(RM_FILE) nx-X11/config/cf/nxversion.def + $(RM_FILE) nx-X11/config/cf/nxconfig.def test: echo "No testing for NX (redistributed)" @@ -205,7 +206,7 @@ install-full: gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 # create a clean nx-X11/.build-exports space - rm -Rf nx-X11/.build-exports + $(RM_DIR_REC) nx-X11/.build-exports mkdir -p nx-X11/.build-exports/include mkdir -p nx-X11/.build-exports/lib @@ -263,5 +264,5 @@ uninstall-full: $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent $(RM_DIR) $(DESTDIR)$(PREFIX)/share/nx/ - if test -d $(DESTDIR)$(NXLIBDIR); then rm -rf $(DESTDIR)$(NXLIBDIR); fi - if test -d $(DESTDIR)$(INCLUDEDIR)/nx; then rm -rf $(DESTDIR)$(INCLUDEDIR)/nx; fi + $(RM_DIR_REC) $(DESTDIR)$(NXLIBDIR) + $(RM_DIR_REC) $(DESTDIR)$(INCLUDEDIR)/nx -- cgit v1.2.3 From a93f64e4f48ac6e1d6926c8d5309fba53cdffd62 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 10 Nov 2018 14:26:49 +0100 Subject: Makefile: use test + && instead of if test/else/fi --- Makefile | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 9ea14c00e..9800f8313 100644 --- a/Makefile +++ b/Makefile @@ -62,19 +62,19 @@ NX_XTRANS_HEADERS = \ all: build clean: - if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp clean; fi - if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy clean; fi - if test -f nx-X11/lib/Makefile; then ${MAKE} -C nx-X11/lib clean; fi - if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad clean; fi - if test -d nx-X11; then ${MAKE} clean-env; fi + test -f nxcomp/Makefile && ${MAKE} -C nxcomp clean + test -f nxproxy/Makefile && ${MAKE} -C nxproxy clean + test -f nx-X11/lib/Makefile && ${MAKE} -C nx-X11/lib clean + test -f nxcompshad/Makefile && ${MAKE} -C nxcompshad clean + test -d nx-X11 && ${MAKE} clean-env distclean: clean - if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp distclean; fi - if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy distclean; fi - if test -f nx-X11/lib/Makefile; then ${MAKE} -C nx-X11/lib distclean; fi - if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad distclean; fi - if test -d nx-X11; then ${MAKE} -C nx-X11 distclean; fi - if [ -x ./mesa-quilt ]; then ./mesa-quilt pop -a; fi + test -f nxcomp/Makefile && ${MAKE} -C nxcomp distclean + test -f nxproxy/Makefile && ${MAKE} -C nxproxy distclean + test -f nx-X11/lib/Makefile && ${MAKE} -C nx-X11/lib distclean + test -f nxcompshad/Makefile && ${MAKE} -C nxcompshad distclean + test -d nx-X11 && ${MAKE} -C nx-X11 distclean + test -x ./mesa-quilt && ./mesa-quilt pop -a $(RM_DIR_REC) nx-X11/extras/Mesa/.pc/ $(RM_FILE) nx-X11/config/cf/nxversion.def $(RM_FILE) nx-X11/config/cf/nxconfig.def @@ -140,7 +140,7 @@ clean-env: version ${MAKE} -j1 -C nx-X11 clean IMAKE_DEFINES="$(IMAKE_DEFINES)" build-lite: - cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} + cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} cd nxproxy && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} build-full: build-env @@ -249,15 +249,15 @@ uninstall: [ ! -d nx-X11 ] || $(MAKE) uninstall-full uninstall-lite: - if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp "$@"; fi - if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy "$@"; fi + test -f nxcomp/Makefile && ${MAKE} -C nxcomp "$@" + test -f nxproxy/Makefile && ${MAKE} -C nxproxy "$@" $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy $(RM_DIR) $(DESTDIR)$(PREFIX)/share/nx/ uninstall-full: - if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad "$@"; fi - if test -f nx-X11/lib/Makefile; then ${MAKE} -C nx-X11/lib "$@"; fi + test -f nxcompshad/Makefile && ${MAKE} -C nxcompshad "$@" + test -f nx-X11/lib/Makefile && ${MAKE} -C nx-X11/lib "$@" $(RM_FILE) $(DESTDIR)$(BINDIR)/nxagent -- cgit v1.2.3 From ffc723e730b06ca50202ea769fa81bcf3ec00ec8 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 11 Nov 2018 11:02:07 +0100 Subject: silence imake compilation Suppress printing the rm and the cc call for every file. Only print the compiler call in case of error. --- nx-X11/config/cf/nxcompile.def | 25 +++++++++++++++++++++++++ nx-X11/config/cf/xorg.cf | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 nx-X11/config/cf/nxcompile.def diff --git a/nx-X11/config/cf/nxcompile.def b/nx-X11/config/cf/nxcompile.def new file mode 100644 index 000000000..9fe0ab7b6 --- /dev/null +++ b/nx-X11/config/cf/nxcompile.def @@ -0,0 +1,25 @@ +/* + our own rules to have a much cleaner compilation output + + derived from Imake.rules +*/ + +#define RemoveFileQuiet(file) @$(RM) -f file \&>/dev/null + +#define ObjectCompile(options) RemoveFileQuiet($@) @@\ + ClearmakeOSName \ + @echo \ \ CC $*.c @@\ + @$(CC) -c $(CFLAGS) options $*.c || { echo \ \ CC failed: $(CC)·-c·$(CFLAGS)·options·$*.c; exit 1; } + +#define RunPrintIfFailed(cmd) @cmd || { echo failed command: cmd; exit 1; } + +#define NormalLibraryTarget(libname,objlist) @@\ +AllTarget(LibraryTargetName(libname)) @@\ + @@\ +LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS) @@\ + @echo \ \ Creating lib: $@ @@\ + RemoveFileQuiet($@) @@\ + RunPrintIfFailed(MakeLibrary($@,objlist)) @@\ + RunPrintIfFailed(RanLibrary($@)) @@\ + RunPrintIfFailed(_LinkBuildLibrary($@)) + diff --git a/nx-X11/config/cf/xorg.cf b/nx-X11/config/cf/xorg.cf index 337c28751..f9928b928 100644 --- a/nx-X11/config/cf/xorg.cf +++ b/nx-X11/config/cf/xorg.cf @@ -53,7 +53,7 @@ RELEASE_VERSION = ReleaseVersion #if NXAgentServer #include "nxconfig.def" - +#include "nxcompile.def" #include "nxversion.def" #if !defined(nxVersionString) && \ -- cgit v1.2.3 From c4656c5e9052779aa395693d3ca52dde940ab027 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 11 Nov 2018 12:30:54 +0100 Subject: imake: also silence makedepend --- nx-X11/config/cf/nxcompile.def | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/nx-X11/config/cf/nxcompile.def b/nx-X11/config/cf/nxcompile.def index 9fe0ab7b6..82192b60b 100644 --- a/nx-X11/config/cf/nxcompile.def +++ b/nx-X11/config/cf/nxcompile.def @@ -6,12 +6,12 @@ #define RemoveFileQuiet(file) @$(RM) -f file \&>/dev/null -#define ObjectCompile(options) RemoveFileQuiet($@) @@\ +#define RunPrintIfFailed(cmd) @cmd || { echo failed command: cmd; exit 1; } + +#define ObjectCompile(options) RemoveFileQuiet($@) @@\ ClearmakeOSName \ @echo \ \ CC $*.c @@\ - @$(CC) -c $(CFLAGS) options $*.c || { echo \ \ CC failed: $(CC)·-c·$(CFLAGS)·options·$*.c; exit 1; } - -#define RunPrintIfFailed(cmd) @cmd || { echo failed command: cmd; exit 1; } + RunPrintIfFailed($(CC) -c $(CFLAGS) options $*.c) #define NormalLibraryTarget(libname,objlist) @@\ AllTarget(LibraryTargetName(libname)) @@\ @@ -23,3 +23,8 @@ LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS) @@\ RunPrintIfFailed(RanLibrary($@)) @@\ RunPrintIfFailed(_LinkBuildLibrary($@)) +#define DependTarget() @@\ +DependDependency() @@\ + @@\ +depend:: @@\ + RunPrintIfFailed($(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS)) -- cgit v1.2.3 From 8632895b8f1d8b8cec45e8d78dd3986c3fa30a4e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 11 Nov 2018 12:31:19 +0100 Subject: imake: adapt output to automake output as seen in lib/src --- nx-X11/config/cf/nxcompile.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/config/cf/nxcompile.def b/nx-X11/config/cf/nxcompile.def index 82192b60b..ca816708f 100644 --- a/nx-X11/config/cf/nxcompile.def +++ b/nx-X11/config/cf/nxcompile.def @@ -17,7 +17,7 @@ AllTarget(LibraryTargetName(libname)) @@\ @@\ LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS) @@\ - @echo \ \ Creating lib: $@ @@\ + @echo \ \ CCLD $@ @@\ RemoveFileQuiet($@) @@\ RunPrintIfFailed(MakeLibrary($@,objlist)) @@\ RunPrintIfFailed(RanLibrary($@)) @@\ -- cgit v1.2.3 From f78a8b3ebe524403a8e055d1dc7a5863e44bc886 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 11 Nov 2018 15:48:17 +0100 Subject: nx-X11/config/cf/nxcompile.def: Rephrase header comment slightly. --- nx-X11/config/cf/nxcompile.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/config/cf/nxcompile.def b/nx-X11/config/cf/nxcompile.def index ca816708f..ff11b5962 100644 --- a/nx-X11/config/cf/nxcompile.def +++ b/nx-X11/config/cf/nxcompile.def @@ -1,5 +1,5 @@ /* - our own rules to have a much cleaner compilation output + Rules to have a much cleaner compilation output derived from Imake.rules */ -- cgit v1.2.3