[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Need ways to make Makefiles more foolproof
From: |
Bo Johansson |
Subject: |
Need ways to make Makefiles more foolproof |
Date: |
Mon, 20 Feb 2012 16:50:49 +0100 |
Hej!
I am trying to find ways to make Makefiles more foolproof and need ideas,
advices, and reference to already established methods. (For background see
http://www.perlmonks.org/?node_id=954865.)
I want to find portable ways in a Makefile to:
1] Find which make program is used
2] Give a warning message
3] Give an error message and stop the make program
4] (If there is a solution to 1] ) Find methods to create more portable
Makefiles
Portable means here that the Makefile can be used by many make programs.
If possible a message should be given if the Makefile is incompatible with the
used make program.
Find which make program is used
-------------------------------
I have so far found a way to distinguish between (gnu)make and dmake:
ifeq "{xxx}" "xxx"
MAKE_USED = dmake
else
MAKE_USED = make
endif
(In dmake "{xxx}" and "xxx" is equal.)
Where can I find examples of such methods?
Are there methods to identify more make programs?
Give a warning message
----------------------
In gnumake
$(warning ERROR: Using $(MAKE_USED) for a Makefile intended for $(MAKE))
can be used. Have not found any good way in dmake.
Are there any portable way to give warning message?
Give an error message and stop the make program
-----------------------------------------------
In gnumake
$(error ERROR: Using $(MAKE_USED) for a Makefile intended for $(MAKE))
can be used. Have not found any good way in dmake.
Are there any portable way to give a message and stop the make program?
Find methods to create more portable Makefiles
----------------------------------------------
This illustrates one idea.
This is included in the beginning of the Makefile:
PS_AT_ARGV_PS = address@hidden
ifeq "MAKE_USED" "dmake"
PS_AT_ARGV_PS = address@hidden
endif
address@hidden can then in the rest of the Makefile be replaced by
$(PS_AT_ARGV_PS)
One example is in:
$(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e "pm_to_blib($(PS_AT_ARGV_PS),
'$(INST_LIB)\auto', q[$(PM_FILTER)], '$(PERM_DIR)')" -- \ ...
Hopefully this will make the Makefile more portable.
Any hit to make more foolproof Makefiles is appreciated!
Best regards
Bo Johansson
- Need ways to make Makefiles more foolproof,
Bo Johansson <=