bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 7/7] Makeconf: simplify the decoding of $(makemode)


From: Jeremie Koenig
Subject: [PATCH 7/7] Makeconf: simplify the decoding of $(makemode)
Date: Mon, 16 Aug 2010 13:51:27 +0200

* Remove the mostly unused $(doinst).
* Set $(installationdir) directly rather than through $(makemode-instdir).
* Reorganize the logic to be more straightforward.

Signed-off-by: Jeremie Koenig <address@hidden>
---
 Makeconf |   89 +++++++++++++++++++++-----------------------------------------
 1 files changed, 30 insertions(+), 59 deletions(-)

diff --git a/Makeconf b/Makeconf
index 5e405ca..96e1d2d 100644
--- a/Makeconf
+++ b/Makeconf
@@ -1,3 +1,4 @@
+#!/usr/bin/make
 # Generic configuration for Hurd compilation
 
 # Directory makefiles should set the variable makemode to either
@@ -94,43 +95,37 @@ MKINSTALLDIRS = $(top_srcdir)/mkinstalldirs
 # linktarg will have the complete set of linked targets, including both
 # .static versions of $(progtarg) and/or shared library object targets.
 
-ifeq ($(makemode),server)
- doinst := one
- makemode-instdir := hurd
+# Only misc dirs handle the cleaning themselves
+ifneq ($(makemode),misc)
  clean := yes
- targets = $(target)
- progtarg = $(targets)
 endif
 
-ifeq ($(makemode),utility)
- doinst := one
- makemode-instdir := bin
- clean := yes
+# Single-target modes
+ifneq (,$(filter server utility, $(makemode)))
  targets = $(target)
 endif
 
-ifeq ($(makemode),servers)
- doinst := many
- makemode-instdir := hurd
- clean := yes
- progtarg := $(targets)
+# Server/utility modes
+ifneq (,$(filter server utility servers utilities, $(makemode)))
+ progtarg := $(filter-out $(special-targets),$(targets))
+ linktarg := $(progtarg) $(progtarg:=.static)
+ cleantarg := $(linktarg)
 endif
 
-ifeq ($(makemode),utilities)
- doinst := many
- makemode-instdir := bin
- clean := yes
- progtarg := $(targets)
+# Server modes
+ifneq (,$(filter server servers, $(makemode)))
+ installationdir ?= $(hurddir)
 endif
 
-ifeq ($(makemode),library)
+# Utility modes
+ifneq (,$(filter utility utilities, $(makemode)))
+ installationdir ?= $(bindir)
+endif
 
+# Libraries
+ifeq ($(makemode),library)
  linktarg := $(libname).so.$(hurd-version)
-
- clean := yes
- cleantarg := $(linktarg) $(addprefix $(libname),.a _p.a _pic.a \
-                                                .so .so.$(hurd-version))
-
+ cleantarg := $(addprefix $(libname),.a _p.a _pic.a .so .so.$(hurd-version))
  targets := $(libname).a $(libname).so
  ifneq ($(no_pic),t)
   targets += $(libname)_pic.a
@@ -138,40 +133,16 @@ ifeq ($(makemode),library)
  ifneq ($(no_prof),t)
   targets += $(libname)_p.a
  endif
-
- ifndef installhdrsubdir
-  installhdrsubdir = hurd
- endif
-
-else
-
- ifeq ($(makemode),misc)
-   ifndef doinst
-     doinst := many
-   endif
-   ifeq ($(doinst),one)
-     targets = $(target)
-   endif
-   ifeq (,$(installationdir))
-     ifneq (,$(targets))
-     ?Error subdir Makefile must define installationdir
-     else
-      makemode-instdir := NOINSTALL
-     endif
-   endif
- else # server/utility modes
-  progtarg := $(filter-out $(special-targets),$(targets))
-  linktarg := $(progtarg) $(progtarg:=.static)
- endif
-
+ installhdrsubdir ?= hurd
 endif
 
-ifndef installationdir
-installationdir := $($(makemode-instdir)dir)
-endif
-
-ifeq ($(cleantarg),)
- cleantarg := $(linktarg)
+# Check that 'misc' makefiles define an installation directory
+ifeq ($(makemode),misc)
+ ifneq (,$(targets))
+  ifeq (,$(installationdir))
+   $(error $(dir)/Makefile must define installationdir)
+  endif
+ endif
 endif
 
 
@@ -260,12 +231,12 @@ $(installationdirlist): %:
        @$(MKINSTALLDIRS) $@
 
 # Building the target
-ifneq ($(makemode),misc)
 
-ifeq ($(doinst),one)
+ifneq (,$(filter server utility, $(makemode)))
 $(linktarg): $(OBJS) $(OTHERLIBS) $(library_deps)
 endif
 
+ifneq ($(makemode),misc)
 # Determine which sort of library we should link against from whether -static
 # is used in LDFLAGS.
 __libext=.so
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]