public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Robert Wong <subdriver97@gmail.com>
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: FW: Makefile help request (config file)
Date: Sat, 29 Dec 2007 17:42:00 -0000	[thread overview]
Message-ID: <C39BC6ED.23BE%subdriver97@gmail.com> (raw)
In-Reply-To: <C39BC5BE.23BA%subdriver97@gmail.com>

[-- 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




      reply	other threads:[~2007-12-29 17:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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     ` Robert Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C39BC6ED.23BE%subdriver97@gmail.com \
    --to=subdriver97@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).