Share makefile rules and vars between client/server
Move all make variables and rules duplicated between gkrellm and gkrellmd makefiles into a common file that can be included. This avoids duplication and hopefully avoids the two makefiles getting out of sync too much. This is also a preparation to ease overriding toolchain binaries (compiler, linker, pkgconfig) as part of windows cross compiling. This change also puts the "ar" tool into a variable that can be overridden if needed. Please note that this change uses the GNU Make specific include statement but AFAICS the makefiles already depend on GNU extensions in other areas (":=" and "ifdef" are non-standard make syntax).
This commit is contained in:
parent
434d79d413
commit
b0b6b5d559
|
@ -0,0 +1,35 @@
|
||||||
|
# makefile variables and rules shared by both gkrellm and gkrellmd
|
||||||
|
|
||||||
|
CC ?= gcc
|
||||||
|
AR ?= ar
|
||||||
|
PKG_CONFIG ?= pkg-config
|
||||||
|
WINDRES ?= windres
|
||||||
|
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
INSTALLROOT ?= $(DESTDIR)$(PREFIX)
|
||||||
|
|
||||||
|
BINMODE ?= 755
|
||||||
|
BINEXT ?=
|
||||||
|
|
||||||
|
INSTALLDIRMODE ?= 755
|
||||||
|
|
||||||
|
INCLUDEDIR ?= $(INSTALLROOT)/include
|
||||||
|
INCLUDEMODE ?= 644
|
||||||
|
INCLUDEDIRMODE ?= 755
|
||||||
|
|
||||||
|
LIBDIR ?= $(INSTALLROOT)/lib
|
||||||
|
LIBDIRMODE ?= 755
|
||||||
|
|
||||||
|
MANMODE ?= 644
|
||||||
|
MANDIRMODE ?= 755
|
||||||
|
|
||||||
|
INSTALL ?= install
|
||||||
|
STRIP ?= -s
|
||||||
|
LINK_FLAGS ?= -Wl,-E
|
||||||
|
|
||||||
|
SHARED_PATH = ../shared
|
||||||
|
# Make GNU Make search for sources somewhere else as well
|
||||||
|
VPATH = $(SHARED_PATH)
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) -c -Wall $(FLAGS) $(CFLAGS) $(CPPFLAGS) $< -o $@
|
|
@ -1,35 +1,16 @@
|
||||||
PACKAGE_D ?= gkrellmd
|
include ../common.mk
|
||||||
PKG_CONFIG ?= pkg-config
|
|
||||||
BINMODE ?= 755
|
|
||||||
BINEXT ?=
|
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
PACKAGE_D ?= gkrellmd
|
||||||
INSTALLROOT ?= $(DESTDIR)$(PREFIX)
|
|
||||||
|
|
||||||
SINSTALLDIR ?= $(INSTALLROOT)/bin
|
SINSTALLDIR ?= $(INSTALLROOT)/bin
|
||||||
INSTALLDIRMODE ?= 755
|
|
||||||
|
|
||||||
INCLUDEDIR ?= $(INSTALLROOT)/include
|
|
||||||
INCLUDEMODE ?= 644
|
|
||||||
INCLUDEDIRMODE ?= 755
|
|
||||||
|
|
||||||
LIBDIR ?= $(INSTALLROOT)/lib
|
|
||||||
LIBDIRMODE ?= 755
|
|
||||||
|
|
||||||
CFGDIR ?= $(INSTALLROOT)/etc
|
CFGDIR ?= $(INSTALLROOT)/etc
|
||||||
CFGDIRMODE ?= 755
|
CFGDIRMODE ?= 755
|
||||||
CFGMODE ?= 644
|
CFGMODE ?= 644
|
||||||
|
|
||||||
SMANDIR ?= $(INSTALLROOT)/share/man/man1
|
SMANDIR ?= $(INSTALLROOT)/share/man/man1
|
||||||
MANMODE ?= 644
|
|
||||||
MANDIRMODE ?= 755
|
|
||||||
INSTALL ?= install
|
|
||||||
LINK_FLAGS ?= -Wl,-E
|
|
||||||
EXTRAOBJS =
|
|
||||||
|
|
||||||
SHARED_PATH = ../shared
|
EXTRAOBJS =
|
||||||
# Make GNU Make search for sources somewhere else as well
|
|
||||||
VPATH = $(SHARED_PATH)
|
|
||||||
|
|
||||||
ifeq ($(without-libsensors),yes)
|
ifeq ($(without-libsensors),yes)
|
||||||
CONFIGURE_ARGS += --without-libsensors
|
CONFIGURE_ARGS += --without-libsensors
|
||||||
|
@ -45,11 +26,6 @@ ifeq ($(HAVE_LIBSENSORS),1)
|
||||||
SENSORS_LIBS ?= -lsensors
|
SENSORS_LIBS ?= -lsensors
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
CC ?= gcc
|
|
||||||
WINDRES ?= windres
|
|
||||||
STRIP ?= -s
|
|
||||||
|
|
||||||
GKRELLMD_INCLUDES = gkrellmd.h $(SHARED_PATH)/log.h
|
GKRELLMD_INCLUDES = gkrellmd.h $(SHARED_PATH)/log.h
|
||||||
|
|
||||||
PKG_INCLUDE = `$(PKG_CONFIG) --cflags glib-2.0 gmodule-2.0 gthread-2.0`
|
PKG_INCLUDE = `$(PKG_CONFIG) --cflags glib-2.0 gmodule-2.0 gthread-2.0`
|
||||||
|
@ -234,11 +210,8 @@ win32-resource.o: win32-resource.rc win32-resource.h
|
||||||
$(WINDRES) $< -o $@
|
$(WINDRES) $< -o $@
|
||||||
win32-libgkrellmd.o: win32-libgkrellmd.c win32-plugin.h $(GKRELLMD_H)
|
win32-libgkrellmd.o: win32-libgkrellmd.c win32-plugin.h $(GKRELLMD_H)
|
||||||
libgkrellmd.a: win32-libgkrellmd.o
|
libgkrellmd.a: win32-libgkrellmd.o
|
||||||
ar -cr libgkrellmd.a win32-libgkrellmd.o
|
$(AR) -cr libgkrellmd.a win32-libgkrellmd.o
|
||||||
|
|
||||||
# Checks if the build environment is ok
|
# Checks if the build environment is ok
|
||||||
check_env:
|
check_env:
|
||||||
$(PKG_CONFIG) --atleast-version=2.32 glib-2.0
|
$(PKG_CONFIG) --atleast-version=2.32 glib-2.0
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) -c -Wall $(FLAGS) $(CFLAGS) $(CPPFLAGS) $< -o $@
|
|
||||||
|
|
33
src/Makefile
33
src/Makefile
|
@ -1,31 +1,13 @@
|
||||||
PACKAGE ?= gkrellm
|
include ../common.mk
|
||||||
PKG_CONFIG ?= pkg-config
|
|
||||||
BINMODE ?= 755
|
|
||||||
BINEXT ?=
|
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
PACKAGE ?= gkrellm
|
||||||
INSTALLROOT ?= $(DESTDIR)$(PREFIX)
|
|
||||||
|
|
||||||
INSTALLDIR ?= $(INSTALLROOT)/bin
|
INSTALLDIR ?= $(INSTALLROOT)/bin
|
||||||
INSTALLDIRMODE ?= 755
|
|
||||||
INCLUDEDIR ?= $(INSTALLROOT)/include
|
|
||||||
INCLUDEMODE ?= 644
|
|
||||||
INCLUDEDIRMODE ?= 755
|
|
||||||
LIBDIR ?= $(INSTALLROOT)/lib
|
|
||||||
LIBDIRMODE ?= 755
|
|
||||||
MANDIR ?= $(INSTALLROOT)/share/man/man1
|
MANDIR ?= $(INSTALLROOT)/share/man/man1
|
||||||
MANMODE ?= 644
|
|
||||||
MANDIRMODE ?= 755
|
|
||||||
INSTALL ?= install
|
|
||||||
LINK_FLAGS ?= -Wl,-E
|
|
||||||
X11_LIBS ?= -L/usr/X11R6/lib -lX11 -lSM -lICE
|
X11_LIBS ?= -L/usr/X11R6/lib -lX11 -lSM -lICE
|
||||||
MATH_LIB ?= -lm
|
MATH_LIB ?= -lm
|
||||||
|
|
||||||
SHARED_PATH = ../shared
|
|
||||||
# Make GNU Make search for sources somewhere else as well
|
|
||||||
VPATH = $(SHARED_PATH)
|
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(without-gnutls),1)
|
ifeq ($(without-gnutls),1)
|
||||||
CONFIGURE_ARGS += --without-gnutls
|
CONFIGURE_ARGS += --without-gnutls
|
||||||
endif
|
endif
|
||||||
|
@ -60,10 +42,6 @@ ifneq ($(HAVE_SSL),1)
|
||||||
EXTRAOBJS ?= md5c.o
|
EXTRAOBJS ?= md5c.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CC ?= gcc
|
|
||||||
WINDRES ?= windres
|
|
||||||
STRIP ?= -s
|
|
||||||
|
|
||||||
GKRELLM_INCLUDES = gkrellm.h gkrellm-public-proto.h $(SHARED_PATH)/log.h
|
GKRELLM_INCLUDES = gkrellm.h gkrellm-public-proto.h $(SHARED_PATH)/log.h
|
||||||
|
|
||||||
PKG_INCLUDE = `$(PKG_CONFIG) --cflags gtk+-2.0 gmodule-2.0 gthread-2.0`
|
PKG_INCLUDE = `$(PKG_CONFIG) --cflags gtk+-2.0 gmodule-2.0 gthread-2.0`
|
||||||
|
@ -348,12 +326,9 @@ win32-resource.o: win32-resource.rc win32-resource.h
|
||||||
$(WINDRES) $< -o $@
|
$(WINDRES) $< -o $@
|
||||||
|
|
||||||
libgkrellm.a: win32-libgkrellm.o
|
libgkrellm.a: win32-libgkrellm.o
|
||||||
ar -cr libgkrellm.a win32-libgkrellm.o
|
$(AR) -cr libgkrellm.a win32-libgkrellm.o
|
||||||
|
|
||||||
# Checks if the build environment is ok
|
# Checks if the build environment is ok
|
||||||
check_env:
|
check_env:
|
||||||
$(PKG_CONFIG) --atleast-version=2.32 glib-2.0
|
$(PKG_CONFIG) --atleast-version=2.32 glib-2.0
|
||||||
$(PKG_CONFIG) --atleast-version=2.4 gtk+-2.0
|
$(PKG_CONFIG) --atleast-version=2.4 gtk+-2.0
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) -c -Wall $(FLAGS) $(CFLAGS) $(CPPFLAGS) $< -o $@
|
|
||||||
|
|
Loading…
Reference in New Issue