Question in MAK file | developer.brewmp.com Question in MAK file | developer.brewmp.com

Developer

Question in MAK file

Forums:

Hi there,

I have my application directory, say MyApp. In which I have MyApp.c file. I have a mak file in a directory below MyApp, like this:

C:\Project\MyApp\ARM\MyApp.mak

And my c file is in
C:\Project\MyApp\MyApp.c

In my mak file I have the Target environment varible to point to MyApp. But when I try to compile, for some reason, it cannot find MyApp.c ( I've given the proper directories etc.. )

But say I chage my Target variable to point to something else, like MyApp1, it works fine ( it can find MyApp.c file ).
But I need to point Traget to MyApp, the mod file and the elf file generated should be MyApp.mod and MyAp.elf.

If I move the makfile to MyApp dir, it will work. But I need to have it in ARM dir. Any ides on how to solve this.

Thanks,
Aperi.

If you do the following in your mak file
CURRENT_DIR = .
SRC_DIR =..
now you refer myapp.c in your mak file as
$(SRC_DIR)\MyApp.c doesn't it work?
It works for me.
ruben

If you do the following in your mak file
CURRENT_DIR = .
SRC_DIR =..
now you refer myapp.c in your mak file as
$(SRC_DIR)\MyApp.c doesn't it work?
It works for me.
ruben

Thanks Ruben for the reply.
I tried your suggession. I still get the following error.
NMAKE : fatal error U1073: don't know how to make 'MyApp.c'
Stop.
-Aperi.

Thanks Ruben for the reply.
I tried your suggession. I still get the following error.
NMAKE : fatal error U1073: don't know how to make 'MyApp.c'
Stop.
-Aperi.

One thing you should make sure that there are no unwanted tab/space at the end of each line in mak file.
ruben

One thing you should make sure that there are no unwanted tab/space at the end of each line in mak file.
ruben

Aperi,
In order for us to debug this, you need to post the section of your mak file that shows your .c.o inference rule, and also the src file symbol, if you use it. (BTW, if you're using cpp, you have to have a different inference rule for it.)
Here's an example that uses Ruben's SRC_DIR symbol:
SRC_FILE = $(@F:.o=.c) # Input source file specification
{$(SRC_DIR)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
"$(ARMCC)" $(CFLAGS) $(INC) $(OBJ_FILE) $(SRC_DIR)\$(SRC_FILE)
@echo ---------------------------------------------------------------
--t

Aperi,
In order for us to debug this, you need to post the section of your mak file that shows your .c.o inference rule, and also the src file symbol, if you use it. (BTW, if you're using cpp, you have to have a different inference rule for it.)
Here's an example that uses Ruben's SRC_DIR symbol:
SRC_FILE = $(@F:.o=.c) # Input source file specification
{$(SRC_DIR)}.c.o:
@echo ---------------------------------------------------------------
@echo OBJECT $(@F)
"$(ARMCC)" $(CFLAGS) $(INC) $(OBJ_FILE) $(SRC_DIR)\$(SRC_FILE)
@echo ---------------------------------------------------------------
--t

Oh, for that to work, you might have to do something like this:
SRC_DIR = ..\\
I haven't tested that, so that might be wrong, but if you have a backslash at the end of the line it has to be quoted by a backslash because otherwise it is a line continuation marker.
--t

Oh, for that to work, you might have to do something like this:
SRC_DIR = ..\\
I haven't tested that, so that might be wrong, but if you have a backslash at the end of the line it has to be quoted by a backslash because otherwise it is a line continuation marker.
--t

NMAKE : fatal error U1073: don't know how to make 'MyApp.c'
Stop.
There are certain cases to get these errors, if u have files like
Bid file,Resource file,Resource header file,if any of these names is not proper, u will get this error.Hopefully the path is correct.

NMAKE : fatal error U1073: don't know how to make 'MyApp.c'
Stop.
There are certain cases to get these errors, if u have files like
Bid file,Resource file,Resource header file,if any of these names is not proper, u will get this error.Hopefully the path is correct.

Quote:Originally posted by Rajs1
NMAKE : fatal error U1073: don't know how to make 'MyApp.c'
Stop.
There are certain cases to get these errors, if u have files like
Bid file,Resource file,Resource header file,if any of these names is not proper, u will get this error.Hopefully the path is correct. That's interesting. I can see the compiler would emit an error if an included header file was incorrect, but I'm surprised it would cause nmake itself to fail. Usually when nmake says "don't know how to make", it tends to mean that it knows what the target is but it can't figure out the source... i.e. the source file is missing, the inference rule has incorrect paths, etc.
--t

Quote:Originally posted by Rajs1
NMAKE : fatal error U1073: don't know how to make 'MyApp.c'
Stop.
There are certain cases to get these errors, if u have files like
Bid file,Resource file,Resource header file,if any of these names is not proper, u will get this error.Hopefully the path is correct. That's interesting. I can see the compiler would emit an error if an included header file was incorrect, but I'm surprised it would cause nmake itself to fail. Usually when nmake says "don't know how to make", it tends to mean that it knows what the target is but it can't figure out the source... i.e. the source file is missing, the inference rule has incorrect paths, etc.
--t

Thanks Guys!
Thanks a lot for the replies.
I figured out the problem. I had something like this at the end of my mak file.
# ------------------------------
# DO NOT EDIT BELOW THIS LINE
AEEAppGen.o : $(SUPPORT_DIR)\AEEAppGen.c
AEEAppGen.o : $(SUPPORT_INCDIR)\AEEAppGen.h
AEEModGen.o : $(SUPPORT_DIR)\AEEModGen.c
AEEModGen.o : $(SUPPORT_INCDIR)\AEEModGen.h
$(TARGET).o : $(TARGET).c
$(TARGET).o : $(SUPPORT_INCDIR)\AEEAppGen.h
$(TARGET).o : $(SUPPORT_INCDIR)\AEEModGen.h
And the problem was here, as $(TARGET).o : $(TARGET).c. I didn't specify the path here.
Later I modified it as this:
$(TARGET).o : $(SRC_DIR)\$(TARGET).c and it worked. This was one place wherein I missed to set the path.
BTW, is this section necessary in a mak file? I followed one of the examples mak file. Also, can you please tell me where should I look for help on writing mak files( for the interface rules etc., ).
Regards,
Aperi.

Thanks Guys!
Thanks a lot for the replies.
I figured out the problem. I had something like this at the end of my mak file.
# ------------------------------
# DO NOT EDIT BELOW THIS LINE
AEEAppGen.o : $(SUPPORT_DIR)\AEEAppGen.c
AEEAppGen.o : $(SUPPORT_INCDIR)\AEEAppGen.h
AEEModGen.o : $(SUPPORT_DIR)\AEEModGen.c
AEEModGen.o : $(SUPPORT_INCDIR)\AEEModGen.h
$(TARGET).o : $(TARGET).c
$(TARGET).o : $(SUPPORT_INCDIR)\AEEAppGen.h
$(TARGET).o : $(SUPPORT_INCDIR)\AEEModGen.h
And the problem was here, as $(TARGET).o : $(TARGET).c. I didn't specify the path here.
Later I modified it as this:
$(TARGET).o : $(SRC_DIR)\$(TARGET).c and it worked. This was one place wherein I missed to set the path.
BTW, is this section necessary in a mak file? I followed one of the examples mak file. Also, can you please tell me where should I look for help on writing mak files( for the interface rules etc., ).
Regards,
Aperi.

Quote:Originally posted by aperi
BTW, is this section necessary in a mak file?No it's not. I'd give a longer answer, but don't have time now. Maybe someone else can....
Quote:Also, can you please tell me where should I look for help on writing mak files( for the interface rules etc., ).Google on "makefile". There are a number of tutorials right at the top of the list.
--t

Quote:Originally posted by aperi
BTW, is this section necessary in a mak file?No it's not. I'd give a longer answer, but don't have time now. Maybe someone else can....
Quote:Also, can you please tell me where should I look for help on writing mak files( for the interface rules etc., ).Google on "makefile". There are a number of tutorials right at the top of the list.
--t

If you want to buy a book then there is a O'Reilley book is there on MakeFile. A good one.
ruben

If you want to buy a book then there is a O'Reilley book is there on MakeFile. A good one.
ruben

Keep in mind that there is "make" and "nmake", make usually being UNIX/GNU make, and nmake being a microsoft tool included with visual studio. Im pretty sure there are some differences between make and nmake, but havent messed with nmake enough to know what they are..
there should be documentation on nmake at the MSDN site as well.
-Tyndal

Keep in mind that there is "make" and "nmake", make usually being UNIX/GNU make, and nmake being a microsoft tool included with visual studio. Im pretty sure there are some differences between make and nmake, but havent messed with nmake enough to know what they are..
there should be documentation on nmake at the MSDN site as well.
-Tyndal

You could also bypass makefiles altogether and use Java build tools like Ant or Anthill.

You could also bypass makefiles altogether and use Java build tools like Ant or Anthill.