bug-make
[Top][All Lists]
Advanced

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

Enhancement request: Multiplatform makes


From: Burt Leland
Subject: Enhancement request: Multiplatform makes
Date: Thu, 26 Oct 2000 12:01:28 -0700

Probably something I've missed in the FAQ.  This definitely seems
more in the ENHANCEMENT category than "bug", so discard if you only
care about true BUG reports.

############################################################################
##
# October 26, 2000
#    I've been working on overhauling our multiplatform build
#    facility onto Gnu make.  It is wonderful that gmake is
#    so ubiquitously supported - sure makes my life easier!
#
#    I'm clearly missing some fundamental point about writing
#    multiplatform makefiles, however, to avoid massive platform
#    dependencies in the resulting suite of makefiles and makefile
#    includes.  I want to force all the platform specific stuff
#    into the makefile include, but NOT have any such details
#    in my core makefile (if possible).
#
#    Seems to me that what I really need is the ability to have a
#    function (or functions) that provide platform specific information
#    like the 'dir' and 'notdir' functions, e.g.,
#
#    $(native filename)
#    $(nativedir filename)
#    $(nativenotdir filename)
#
#    As it is, I need to write "wrappers" (Perl) to convert the unix-like
#    file specifications spit out from my Gnu make build into native
#    commands on the respective platforms.  Basically I end up using Perl
#    to do filename translation stuff that internally must already be
#    done in the guts of Gnu make.
#
#    As my time allows, I'll investigate the implementation of this
#    capability, but perhaps I'm just overlooking something obvious?
#
#    Flames and comments welcome (well, the latter anyway).
#
#    Burton A. Leland
#    address@hidden
#---------------------------------------------------------------------------
---
#
#  sgi:irix> gmake clean
#  rm -f ../gnumake/A.txt ../gnumake/B.txt ../gnumake/C.txt
#  rm -f ../gnumake/A.out ../gnumake/B.out ../gnumake/C.out
#  sgi:irix> gmake
#  Creating ../gnumake/A.txt
#  Creating ../gnumake/B.txt
#  Creating ../gnumake/C.txt
#  Creating ../gnumake/A.out from ../gnumake/A.txt
#  ../gnumake/A.out dir:../gnumake/ notdir:A.out pc-ified:..\gnumake\A.out
#
#  what I really want is $(native $@) so I can execute,
#     Creating ..\gnumake\A.out from ..\gnumake\A.txt # if on a PC
#     Creating ../gnumake/A.out from ../gnumake/A.txt # if on Unix
#     Creating [-.gnumake]A.out from [-.gnumake]A.txt # if on VMS
#
#  cp ../gnumake/A.txt ../gnumake/A.out
#  Creating ../gnumake/B.out from ../gnumake/B.txt
#  ../gnumake/B.out dir:../gnumake/ notdir:B.out pc-ified:..\gnumake\B.out
#
#  what I really want is $(native $@) so I can execute,
#     Creating ..\gnumake\B.out from ..\gnumake\B.txt # if on a PC
#     Creating ../gnumake/B.out from ../gnumake/B.txt # if on Unix
#     Creating [-.gnumake]B.out from [-.gnumake]B.txt # if on VMS
#
#  cp ../gnumake/B.txt ../gnumake/B.out
#  Creating ../gnumake/C.out from ../gnumake/C.txt
#  ../gnumake/C.out dir:../gnumake/ notdir:C.out pc-ified:..\gnumake\C.out
#
#  what I really want is $(native $@) so I can execute,
#     Creating ..\gnumake\C.out from ..\gnumake\C.txt # if on a PC
#     Creating ../gnumake/C.out from ../gnumake/C.txt # if on Unix
#     Creating [-.gnumake]C.out from [-.gnumake]C.txt # if on VMS
#
#  cp ../gnumake/C.txt ../gnumake/C.out
#
############################################################################
##
#   define a simple relative pathname to this directory
#
#   NOTE: Only '../thisdirectory' functions correctly!
#
SOURCE = ../gnumake

# some trivial stuff we need to exercise this
ECHO = print
CP = cp
TOUCH = touch
RMFORCE = rm -f
SHELL = /bin/ksh

############################################################################
##

FAKEDEPENDENCIES = $(SOURCE)/A.out $(SOURCE)/B.out $(SOURCE)/C.out
FAKETARGETS      = $(SOURCE)/A.txt $(SOURCE)/B.txt $(SOURCE)/C.txt

.PHONY: all clean cleandependencies cleantargets

all: $(FAKETARGETS) $(FAKEDEPENDENCIES)

clean:  cleantargets cleandependencies

cleandependencies:
        $(RMFORCE) $(FAKETARGETS:.txt=.out)

cleantargets:
        $(RMFORCE) $(FAKETARGETS)

# empty
install: ;

# "convert" the fake target to the fake dependency and echo some info about
it
$(SOURCE)/%.out : $(SOURCE)/%.txt
        @$(ECHO) "Creating $@ from $<"
        @$(ECHO) "$@ dir:$(dir $@) notdir:$(notdir $@) pc-ified:$(subst
/,\\,$@)\\n"
        @$(ECHO) "what I really want is \$$(native \$$@) so I can execute,"
        @$(ECHO) "   Creating $(subst /,\\,$@) from $(subst /,\\,$<) # if on
a PC"
        @$(ECHO) "   Creating $@ from $< # if on Unix"
        @$(ECHO) "   Creating [$(patsubst %.,%,$(subst /,.,$(subst
..,-,$(dir $@))))]$(notdir $@) from [$(patsubst %.,%,$(subst /,.,$(subst
..,-,$(dir $<))))]$(notdir $<) # if on VMS\\n"
        $(CP) $< $@

# make a fake target if missing
$(SOURCE)/%.txt :
        @$(ECHO) "Creating $@"
        @$(TOUCH) $@





reply via email to

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