* Makefile help request
@ 2007-12-06 22:15 Robert Wong
2007-12-07 0:35 ` Tom Browder
0 siblings, 1 reply; 4+ messages in thread
From: Robert Wong @ 2007-12-06 22:15 UTC (permalink / raw)
To: gcc-help
[-- Attachment #1: Type: text/plain, Size: 733 bytes --]
Question 1:
I am trying to establish the following dependencies in the attached Makefile
(currently, make executes every command in the makefile):
- for MCSIM_CPP files if there is a change to any .cpp file, re-compile that
specific file(s) to .o
- for DRAMSIM_C files if there is a change to any .c file, re-compile that
specific file(s) to .o (Note: there is 1 .cpp file in this set -
memory-dram.cpp)
- I tried to establish some macros (DRAMSIM_C, DRAMSIM_OBJS, MCSIM_CPP,
MCSIM_OBJS) but make doesn't seem to recognize unless I list all the files
manually.
Question 2:
If use the following line:
G++ -c mem.c mem.h dram.h
Is it the same as:
G++ -c mem.c mem.h
(assuming that #include "dram.h" is in mem.h?)
Thanks,
Robert
[-- Attachment #2: Makefile-all1.c --]
[-- Type: application/octet-stream, Size: 4092 bytes --]
## DEFINE THE ROOT AND THE LIBRARIES
TARGET = SESC_DRIVER
BUILD_DIR = /tmp/DRAMsim-12/
## DO NOT TOUCH BELOW THIS LINE
CC = g++
OPT = -O2
DEBUG = -g
OTHER = -O6 -mcpu=i686 -malign-double -funroll-all-loops\
-ffast-math -fno-exceptions
CFLAGS = $(DEBUG) -mcpu=i686
INCLUDE = -I$(BUILD_DIR)
DRAMSIM_OBJS = $(DRAMSIM_C:.c=.o)
MCSIM_OBJS = $(MCSIM_CPP:.cpp=.o)
default : $(TARGET)
#all : mcsim mem-biu.o mem-stat.o mem-dram.o mem-statemachine.o mem-address.o mem-dram-helper.o mem-commandissuetest.o mem-fileio.o mem-transactions.o mem-bundle.o mem-amb-buffer.o mem-refresh.o mem-issuecommands.o mem-dram-power.o mem-dram-mcsim-interface.o $(TARGET)
$(TARGET): mcsim mem-biu.o mem-stat.o mem-dram.o mem-statemachine.o mem-address.o mem-dram-helper.o mem-commandissuetest.o mem-fileio.o mem-transactions.o mem-bundle.o mem-amb-buffer.o mem-refresh.o mem-issuecommands.o mem-dram-power.o mem-dram-mcsim-interface.o memory-dram.o
$(CC) $(CFLAGS) -o $(TARGET) $(MCSIM_OBJS) $(DRAMSIM_OBJS) memory-dram.o $(INCLUDE)
mcsim : SESC_NOC_interface.cpp CentralPageHandler.cpp CentralMemorySystem.cpp SockMonitor.cpp Socket.cpp Snippets.cpp main.cpp MsgQueue.cpp SockMsg.cpp MemMsg.cpp L2Cache.cpp NoCInterface.cpp cache.cpp directorycache.cpp NetMsgBuffer.cpp RouterAssignment.cpp simplenoc.cpp CommonTimeStampMsg.cpp
$(CC) $(CFLAGS) -c $(MCSIM_CPP) $(INCLUDE)
mem-fileio.o : mem-fileio.c mem-tokens.h mem-system.h
$(CC) $(CFLAGS) -c mem-fileio.c mem-tokens.h mem-system.h
mem-dram.o : mem-dram.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-dram.c mem-system.h mem-biu.h
mem-dram-helper.o: mem-dram-helper.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-dram-helper.c mem-system.h mem-biu.h
mem-dram-power.o: mem-dram-power.c mem-system.h
$(CC) $(CFLAGS) -c mem-dram-power.c mem-system.h
mem-commandissuetest.o: mem-commandissuetest.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-commandissuetest.c mem-system.h mem-biu.h
mem-statemachine.o: mem-statemachine.c mem-commandissuetest.c mem-system.h
$(CC) $(CFLAGS) -c mem-statemachine.c mem-commandissuetest.c mem-system.h
mem-bundle.o: mem-bundle.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-bundle.c mem-system.h mem-biu.h
mem-biu.o: mem-biu.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-biu.c mem-system.h mem-biu.h
mem-stat.o: mem-stat.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-stat.c mem-system.h mem-biu.h
mem-refresh.o: mem-refresh.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-refresh.c mem-system.h mem-biu.h
mem-issuecommands.o: mem-issuecommands.c mem-system.h
$(CC) $(CFLAGS) -c mem-issuecommands.c mem-system.h
mem-address.o: mem-address.c mem-system.h
$(CC) $(CFLAGS) -c mem-address.c mem-system.h
mem-transactions.o: mem-transactions.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-transactions.c mem-system.h mem-biu.h
mem-amb-buffer.o: mem-amb-buffer.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-amb-buffer.c mem-system.h mem-biu.h
memory-dram.o : memory-dram.cpp memory-dram.h mem-dram-mcsim-interface.h
$(CC) $(CFLAGS) -c memory-dram.cpp memory-dram.h mem-dram-mcsim-interface.h
mem-dram-mcsim-interface.o: mem-dram-mcsim-interface.c mem-dram-mcsim-interface.h mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-dram-mcsim-interface.c mem-dram-mcsim-interface.h mem-system.h mem-biu.h
# source files
##############################################################################
MCSIM_CPP = SESC_NOC_interface.cpp CentralPageHandler.cpp CentralMemorySystem.cpp SockMonitor.cpp Socket.cpp Snippets.cpp main.cpp MsgQueue.cpp SockMsg.cpp MemMsg.cpp L2Cache.cpp NoCInterface.cpp cache.cpp directorycache.cpp NetMsgBuffer.cpp RouterAssignment.cpp simplenoc.cpp CommonTimeStampMsg.cpp
DRAMSIM_C = mem-biu.c mem-stat.c mem-dram.c mem-statemachine.c mem-address.c mem-dram-helper.c mem-commandissuetest.c mem-fileio.c mem-transactions.c mem-bundle.c mem-amb-buffer.c mem-refresh.c mem-issuecommands.c mem-dram-power.c mem-dram-mcsim-interface.c
##############################################################################
clean:
rm $(TARGET)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Makefile help request
2007-12-06 22:15 Makefile help request Robert Wong
@ 2007-12-07 0:35 ` Tom Browder
2007-12-29 17:37 ` Makefile help request (config file) Robert Wong
0 siblings, 1 reply; 4+ messages in thread
From: Tom Browder @ 2007-12-07 0:35 UTC (permalink / raw)
To: Robert Wong; +Cc: gcc-help
On Dec 6, 2007 4:15 PM, Robert Wong <subdriver97@gmail.com> wrote:
> Question 1:
> I am trying to establish the following dependencies in the attached Makefile
> (currently, make executes every command in the makefile):
Robert, the attached make file has a line near its beginning that says:
## DO NOT TOUCH BELOW THIS LINE
which indicates it was originally automatically generated. If that is
so, have you modified it since the original? If so, can you send the
original.
A brief glance shows that the make file is relying on automatic rules
and there may be some problem there since you have defined CC as the
g++ compiler and you have mixed c and c++ code.
-Tom
Tom Browder
Niceville, Florida
USA
^ permalink raw reply [flat|nested] 4+ messages in thread
* Makefile help request (config file)
2007-12-07 0:35 ` Tom Browder
@ 2007-12-29 17:37 ` Robert Wong
2007-12-29 17:42 ` FW: " Robert Wong
0 siblings, 1 reply; 4+ messages in thread
From: Robert Wong @ 2007-12-29 17:37 UTC (permalink / raw)
To: gcc-help
In the two attached files:
1.Makefile
2.ct (script file)
I am trying to make multiple executables with the name SESC_DRIVER#, where
"#" is associated with a different config file for
mem-dram-mcsim-interface.o (using mem-dramsim-config-#.h).
Right now, I can use the Makefile with the following command line:
>make N='#'
But each time before I can use that command I must delete the existing
mem-dram-mcsim-interface.o otherwise the makefile won't make the
mem-dram-mcsim-interface.o with the new mem-dramsim-config-#.h.
I tried to write file 2 (ct) to delete the mem-dram-mcsim-interface.o and
invoke the make N='#' line but I think the script is having problems
recognizing the command line arguments ($1) in the form make N='$1' because
of the single quotes.
Thanks in advance for any help you can offer.
Rob
^ permalink raw reply [flat|nested] 4+ messages in thread
* FW: Makefile help request (config file)
2007-12-29 17:37 ` Makefile help request (config file) Robert Wong
@ 2007-12-29 17:42 ` Robert Wong
0 siblings, 0 replies; 4+ messages in thread
From: Robert Wong @ 2007-12-29 17:42 UTC (permalink / raw)
To: gcc-help
[-- Attachment #1: Type: text/plain, Size: 1145 bytes --]
Probably help if I attached the files...
------ Forwarded Message
From: Robert Wong <subdriver97@gmail.com>
Date: Sat, 29 Dec 2007 09:37:02 -0800
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Conversation: Makefile help request (config file)
Subject: Makefile help request (config file)
In the two attached files:
1.Makefile
2.ct (script file)
I am trying to make multiple executables with the name SESC_DRIVER#, where
"#" is associated with a different config file for
mem-dram-mcsim-interface.o (using mem-dramsim-config-#.h).
Right now, I can use the Makefile with the following command line:
>make N='#'
But each time before I can use that command I must delete the existing
mem-dram-mcsim-interface.o otherwise the makefile won't make the
mem-dram-mcsim-interface.o with the new mem-dramsim-config-#.h.
I tried to write file 2 (ct) to delete the mem-dram-mcsim-interface.o and
invoke the make N='#' line but I think the script is having problems
recognizing the command line arguments ($1) in the form make N='$1' because
of the single quotes.
Thanks in advance for any help you can offer.
Rob
------ End of Forwarded Message
[-- Attachment #2: ct --]
[-- Type: application/octet-stream, Size: 62 bytes --]
#!/bin/sh
rm mem-dram-mcsim-interface.o
echo $1
make DC='$1'
[-- Attachment #3: Makefile --]
[-- Type: application/octet-stream, Size: 4061 bytes --]
## DEFINE THE ROOT AND THE LIBRARIES
TARGET = SESC_DRIVER
BUILD_DIR = /tmp/dec19/
## DO NOT TOUCH BELOW THIS LINE
CXX = g++
CC = g++
OPT = -O2
DEBUG = -g
OTHER = -O6 -mcpu=i686 -malign-double -funroll-all-loops -ffast-math -fno-exceptions
CFLAGS = $(DEBUG) $(OTHER)
INCLUDE = -I$(BUILD_DIR)
# Your definitions need to be before the first target if you want to use them
# (I recommend putting all this in separate files to be included--see my
# examples attached--removing clutter helps me see what's happening when I
# have Makefile problems).
# source files
# variable DC needs to be configured at the commandline (for creating test runs)
MCSIM_CPP = SESC_NOC_interface.cpp CentralPageHandler.cpp CentralMemorySystem.cpp SockMonitor.cpp Socket.cpp Snippets.cpp main.cpp\
MsgQueue.cpp SockMsg.cpp MemMsg.cpp L2Cache.cpp NoCInterface.cpp cache.cpp directorycache.cpp NetMsgBuffer.cpp RouterAssignment.cpp\
simplenoc.cpp CommonTimeStampMsg.cpp
DRAMSIM_C = mem-biu.c mem-stat.c mem-dram.c mem-statemachine.c mem-address.c mem-dram-helper.c mem-commandissuetest.c mem-fileio.c\
mem-transactions.c mem-bundle.c mem-amb-buffer.c mem-refresh.c mem-issuecommands.c mem-dram-power.c mem-dram-mcsim-interface.c
MCSIM_OBJS = $(MCSIM_CPP:.cpp=.o)
DRAMSIM_OBJS = $(DRAMSIM_C:.c=.o)
DC = mem-dramsim-config-$(N).h
default : $(TARGET)$(N)
# note that no $(INCLUDE) macro is required for the link line
$(TARGET)$(N): $(MCSIM_OBJS) $(DRAMSIM_OBJS) memory.o
$(CC) $(CFLAGS) -o $(TARGET)$(N) $(MCSIM_OBJS) $(DRAMSIM_OBJS) memory.o $(INCLUDE)
# These may not be needed, but I don't know what, if any, compiling errors you
# are getting--when I compile C source with g++, I rename the files to have a
# .cc (or .cpp) extension to avoid subtle problems that may crop up.
%.o : %.cpp RouterAssignment.h
$(CC) $(CFLAGS) -c $< $(INCLUDE)
%.o : %.c
$(CC) $(CFLAGS) -c $< $(INCLUDE)
mem-fileio.o : mem-fileio.c mem-tokens.h mem-system.h
$(CC) $(CFLAGS) -c mem-fileio.c mem-tokens.h mem-system.h $(INCLUDE)
mem-dram.o : mem-dram.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-dram.c mem-system.h mem-biu.h $(INCLUDE)
mem-dram-helper.o: mem-dram-helper.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-dram-helper.c mem-system.h mem-biu.h $(INCLUDE)
mem-dram-power.o: mem-dram-power.c mem-system.h
$(CC) $(CFLAGS) -c mem-dram-power.c mem-system.h $(INCLUDE)
mem-commandissuetest.o: mem-commandissuetest.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-commandissuetest.c mem-system.h mem-biu.h $(INCLUDE)
mem-statemachine.o: mem-statemachine.c mem-commandissuetest.c mem-system.h
$(CC) $(CFLAGS) -c mem-statemachine.c mem-commandissuetest.c mem-system.h $(INCLUDE)
mem-bundle.o: mem-bundle.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-bundle.c mem-system.h mem-biu.h $(INCLUDE)
mem-biu.o: mem-biu.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-biu.c mem-system.h mem-biu.h $(INCLUDE)
mem-stat.o: mem-stat.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-stat.c mem-system.h mem-biu.h $(INCLUDE)
mem-refresh.o: mem-refresh.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-refresh.c mem-system.h mem-biu.h $(INCLUDE)
mem-issuecommands.o: mem-issuecommands.c mem-system.h
$(CC) $(CFLAGS) -c mem-issuecommands.c mem-system.h $(INCLUDE)
mem-address.o: mem-address.c mem-system.h
$(CC) $(CFLAGS) -c mem-address.c mem-system.h $(INCLUDE)
mem-transactions.o: mem-transactions.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-transactions.c mem-system.h mem-biu.h $(INCLUDE)
mem-amb-buffer.o: mem-amb-buffer.c mem-system.h mem-biu.h
$(CC) $(CFLAGS) -c mem-amb-buffer.c mem-system.h mem-biu.h $(INCLUDE)
memory.o : memory.cpp memory.h mem-dram-mcsim-interface.h
$(CC) $(CFLAGS) -c memory.cpp memory.h mem-dram-mcsim-interface.h $(INCLUDE)
mem-dram-mcsim-interface.o: mem-dram-mcsim-interface.c mem-dram-mcsim-interface.h mem-system.h mem-biu.h $(DC)
$(CC) $(CFLAGS) -c mem-dram-mcsim-interface.c mem-dram-mcsim-interface.h mem-system.h mem-biu.h $(DC) $(INCLUDE)
clean:
-rm $(TARGET)
realclean: clean
-rm *~ *.o
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-12-29 17:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-06 22:15 Makefile help request Robert Wong
2007-12-07 0:35 ` Tom Browder
2007-12-29 17:37 ` Makefile help request (config file) Robert Wong
2007-12-29 17:42 ` FW: " Robert Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).