OK...I'm new to this and I'm sure I'm missing something obvious, so
please be kind.
I've tried several different approaches to this problem (including
various if, ifeq, and case constructs), and I'm about to give up. Can
any tell me why this doesn't work? In a nutshell, I want a Makefile
that will "include" either a Linux.mk or a SunOS.mk without having to
rely on an explicit command line parameter or env var.
Here is the segment that is giving me trouble:
################################################## #######################
#
#
# Sample Makefile #
#
#
################################################## #######################
#.SILENT:
# Use a known shell
SHELL=/bin/sh
# Obtain OS name (e.g., "Linux" or "SunOS")
THE_OS := `uname`
# Name the INCFILE using the OS name (e.g., "Macros.Linux.mk")
INCFILE := $(HOME)/src/Macros.$(THE_OS).mk
# Test defined macros to see if I have what I expect
echo:
@echo "THE_OS = :"$(THE_OS)":"
@echo "INCFILE = :"$(INCFILE)":"
ls -al $(INCFILE)
# Include the project default macros
include $(INCFILE)
<EOF>
-----------------------And here is the error I get
---------------------------
localhost.localdomain]/home/tponko/src% make
Makefile:20: /home/tponko/src/Macros.`uname`.mk: No such file or
directory
make: *** No rule to make target `/home/tponko/src/Macros.`uname`.mk'.
Stop.
Any/all help will be greatly appreciated.
Thanks... 3 4056
The Makefile is fine. Simply running the command "make", though, is not. The parser thinks that
THE_OS :=
is a command-rule. Simply run "make echo", and you should get what you're looking for!
Hope I helped!
-Elliot :)
On 16 Dec 2003 14:19:30 -0800 tm*****@yahoo.com (tmponko) wrote: OK...I'm new to this and I'm sure I'm missing something obvious, so please be kind.
I've tried several different approaches to this problem (including various if, ifeq, and case constructs), and I'm about to give up. Can any tell me why this doesn't work? In a nutshell, I want a Makefile that will "include" either a Linux.mk or a SunOS.mk without having to rely on an explicit command line parameter or env var.
Here is the segment that is giving me trouble:
################################################## ####################### # # # Sample Makefile # # # ################################################## #######################
#.SILENT:
# Use a known shell SHELL=/bin/sh
# Obtain OS name (e.g., "Linux" or "SunOS") THE_OS := `uname`
# Name the INCFILE using the OS name (e.g., "Macros.Linux.mk") INCFILE := $(HOME)/src/Macros.$(THE_OS).mk
# Test defined macros to see if I have what I expect echo: @echo "THE_OS = :"$(THE_OS)":" @echo "INCFILE = :"$(INCFILE)":" ls -al $(INCFILE)
# Include the project default macros include $(INCFILE)
<EOF>
-----------------------And here is the error I get ---------------------------
localhost.localdomain]/home/tponko/src% make Makefile:20: /home/tponko/src/Macros.`uname`.mk: No such file or directory make: *** No rule to make target `/home/tponko/src/Macros.`uname`.mk'. Stop.
Any/all help will be greatly appreciated.
Thanks...
--
"Serpent!" screamed the Pigeon.
"I'm not a serpent!" said Alice indignantly. "Let me alone!"
"Serpent, I say again!" repeated the Pigeon, but in a more subdued tone, and added with a kind of sob, "I've tried every way, and nothing seems to suit them!"
- L. Carroll
-==++==++==++==++==++==-
"Always the hours." a_*****@hotpop.com wrote in message news:<20031216181717.0101e2ac.a_*****@hotpop.com>. .. The Makefile is fine. Simply running the command "make", though, is not. The parser thinks that THE_OS := is a command-rule. Simply run "make echo", and you should get what you're looking for!
Hope I helped! -Elliot :)
Elliot,
I gave your suggestion another shot (see below), but got the same
result.
From the reading I've done I get the impression that make performs two
passes, and macro substitution for the "include $(INCFILE)" statement
is not resolving to the value of function `uname` used in the INCFILE
declaration.
So I'm still stumped...
Thanks
[tponko@localhost src]$ make echo
Makefile:19: /home/tponko/src/Macros.`uname`.mk: No such file or
directory
make: *** No rule to make target `/home/tponko/src/Macros.`uname`.mk'.
Stop.
So I gave up and moved the compiler definition to my login script.
Since make recognizes env vars, this brute force approach was
sufficient. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Raghuveer Pallikonda |
last post by:
Hi,
I am trying to stub out debug log messages in my application, if
the logging subsystem is not enabled.. For e.g a invocation
#define LOGMSG !Logger::Enabled() ? false : Logger::LogMsg
so...
|
by: Siemel Naran |
last post by:
#define EXPECT_ASSERT(x) { if (!x) expect_assert(localVariable, __FILE__,
__LINE__, #x); }
MSVC7 gives an error: "error C2014: preprocessor command must start as first
nonwhite space".
|
by: Newbie_sw2003 |
last post by:
Where should I use them?
I am giving you my understandings. Please correct me if I am wrong:
MACRO:
e.g.:#define ref-name 99
The code is substituted by the MACRO ref-name. So no overhead....
|
by: Casanova |
last post by:
Hello!!!
I have been using C for a very short while. I am used to macros in C,
but while i was reading the code for LittleOS (an open source OS), i
came across a type of macro wherein no value...
|
by: Malcolm |
last post by:
Hi,
I have the following which fails with "disagreement in number of macro
arguments" when compiling with Imagecraft ICCAVR. Has anyone got any
ideas - its not vital but would make the code a...
| |
by: Rodolfo |
last post by:
Hello, there's another languages that can do a macro substitution, how can I
do this in Csharp.
This is an example of what I want to do
Dataset ds = new Dataset;
string a = "ds";
DataSet...
|
by: Don |
last post by:
I think "macro substitution" is the correct term for what I want to do, but,
to be sure, here is a description of what I'd like to know is possible:
I want to be able to create a create an object...
|
by: junky_fellow |
last post by:
hi guys,
Can you please suggest that in what cases should a macro be
preferred over inline function and viceversa ? Is there any case where
using a macro will be more efficient as compared to...
|
by: rpjanaka |
last post by:
I am using an open source library called IGI_UDP for measure the available bandwidth of a link (http://www.cs.cmu.edu/%7Ehnn/igi/ ).
with that library they have provided a "Makefile" which is not an...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |