Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: From: "Schaible, Joerg" To: "'cygwin-list'" Subject: Magic variables for make and Cygwin drive mapping Date: Wed, 1 Sep 1999 10:56:08 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id EAA08321 Hello, writing currently GNU make compatible make files for different plattforms I also have to deal with the Cygwin naming scheme using absolute paths within the system. The make rules and Cygwin tools handle the Cygwin drive mapping, the probably needed DOS/Win-based tools won't. So I have defined the following variables to deal with the situation within the rules. To convert your own file names or directory lists just have a look at the first variable RT and replace the $@ by your variable. The "macro" will preserve the sequence. You may test your variables with the debug targets at the end (e.g. make for.TEST TEST="a b c d e f"). Hope others will find this helpfull. Greetings Jörg ------------------------------ cygwin path converter variables ----------------------------------------- # Special variables to deal with cygwin ifeq ($(OSTYPE),cygwin32) ALLDRIVES := a b c d e f g h i j k l m n o p q r s t u v w x y z CYGWINROOTDRIVE := c CYGWINMAPPING := // #CYGWINMAPPING := /cygwin/ # Rule target RT = $(strip $(subst /,\\,$(foreach directory,$@,$(foreach drive,$(ALLDRIVES),$(filter $(drive):/%,$(patsubst //$(drive)/%,$(drive):/%,$(directory)))) $(patsubst /%,$(CYGWINROOTDRIVE):/%,$(filter-out $(CYGWINMAPPING)%,$(directory)))))) # First dependend RF = $(strip $(subst /,\\,$(foreach directory,$<,$(foreach drive,$(ALLDRIVES),$(filter $(drive):/%,$(patsubst //$(drive)/%,$(drive):/%,$(directory)))) $(patsubst /%,$(CYGWINROOTDRIVE):/%,$(filter-out $(CYGWINMAPPING)%,$(directory)))))) # Newer dependend RN = $(strip $(subst /,\\,$(foreach directory,$?,$(foreach drive,$(ALLDRIVES),$(filter $(drive):/%,$(patsubst //$(drive)/%,$(drive):/%,$(directory)))) $(patsubst /%,$(CYGWINROOTDRIVE):/%,$(filter-out $(CYGWINMAPPING)%,$(directory)))))) # All dependend RA = $(strip $(subst /,\\,$(foreach directory,$^,$(foreach drive,$(ALLDRIVES),$(filter $(drive):/%,$(patsubst //$(drive)/%,$(drive):/%,$(directory)))) $(patsubst /%,$(CYGWINROOTDRIVE):/%,$(filter-out $(CYGWINMAPPING)%,$(directory)))))) # Stem of rule target RS = $(strip $(subst /,\\,$(foreach directory,$*,$(foreach drive,$(ALLDRIVES),$(filter $(drive):/%,$(patsubst //$(drive)/%,$(drive):/%,$(directory)))) $(patsubst /%,$(CYGWINROOTDRIVE):/%,$(filter-out $(CYGWINMAPPING)%,$(directory)))))) # Rule target without extension RTB = $(strip $(subst /,\\,$(foreach directory,$(basename $@),$(foreach drive,$(ALLDRIVES),$(filter $(drive):/%,$(patsubst //$(drive)/%,$(drive):/%,$(directory)))) $(patsubst /%,$(CYGWINROOTDRIVE):/%,$(filter-out $(CYGWINMAPPING)%,$(directory)))))) # First dependend without extension RFB = $(strip $(subst /,\\,$(foreach directory,$(basename $<),$(foreach drive,$(ALLDRIVES),$(filter $(drive):/%,$(patsubst //$(drive)/%,$(drive):/%,$(directory)))) $(patsubst /%,$(CYGWINROOTDRIVE):/%,$(filter-out $(CYGWINMAPPING)%,$(directory)))))) # Rule target directory RTD = $(strip $(subst /,\\,$(foreach directory,$(@D),$(foreach drive,$(ALLDRIVES),$(filter $(drive):/%,$(patsubst //$(drive)/%,$(drive):/%,$(directory)))) $(patsubst /%,$(CYGWINROOTDRIVE):/%,$(filter-out $(CYGWINMAPPING)%,$(directory)))))) # First dependend directory RFD = $(strip $(subst /,\\,$(foreach directory,$(