public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Makefile Help
@ 2002-03-15  7:13 Rich
  2002-03-15  8:05 ` Kayvan A. Sylvan
  0 siblings, 1 reply; 6+ messages in thread
From: Rich @ 2002-03-15  7:13 UTC (permalink / raw)
  To: gcc-help

I'm new to gcc and am running Mandrake Linux 8.1 with gcc 2.96-0.62mdk.

I've been experimenting with writing my own makefiles and have run into
a problem.  The makefiles work OK as long as all of the source code is
in the same subdirectory, however, if the source is in another
subdirectory, the makefile can't find it.  Here's a simple code sample:

-------------------------------------------------
CC = gcc

all: simple

vpath %.h ~/Projects/test/src

simple.o: simple.c 
	$(CC) -c simple.c

simple: simple.o
	$(CC) -o simple simple.o
-------------------------------------------------------

The source code is in the /Projects/test subdirectory but simple.c has a
header file called foo.h that's in the /Projects/test/src subdirectory. 
The error message is "No such file or directory called foo.h".  Why
isn't it being found?  VPATH= ~/Projects/test/src doesn't work either.

What's missing?

TIA

Rich

-- 
rluchor@optonline.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Makefile Help
  2002-03-15  7:13 Makefile Help Rich
@ 2002-03-15  8:05 ` Kayvan A. Sylvan
  0 siblings, 0 replies; 6+ messages in thread
From: Kayvan A. Sylvan @ 2002-03-15  8:05 UTC (permalink / raw)
  To: Rich; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

On Fri, Mar 15, 2002 at 10:17:28AM -0500, Rich wrote:
> I'm new to gcc and am running Mandrake Linux 8.1 with gcc 2.96-0.62mdk.
> 
> I've been experimenting with writing my own makefiles and have run into
> a problem.  The makefiles work OK as long as all of the source code is
> in the same subdirectory, however, if the source is in another
> subdirectory, the makefile can't find it.  Here's a simple code sample:
> 
> -------------------------------------------------
> CC = gcc
> 
> all: simple
> 
> vpath %.h ~/Projects/test/src
> 
> simple.o: simple.c 
> 	$(CC) -c simple.c
> 
> simple: simple.o
> 	$(CC) -o simple simple.o
> -------------------------------------------------------
> 
> The source code is in the /Projects/test subdirectory but simple.c has a
> header file called foo.h that's in the /Projects/test/src subdirectory. 
> The error message is "No such file or directory called foo.h".  Why
> isn't it being found?  VPATH= ~/Projects/test/src doesn't work either.
> 
> What's missing?

You don't use vpath for the c compiler/pre-processor.

Instead, use the -I flag:

CC = gcc
CFLAGS = -I /some/other/directory

%.o: %.c
	$(CC) $(CFLAGS) -c $<

all: simple

simple: simple.o
	$(CC) -o simple simple.o 

-- 
Kayvan A. Sylvan          | Proud husband of       | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: makefile help
  2009-09-28 13:43 ` Brian Budge
@ 2009-09-28 15:45   ` Philip Herron
  0 siblings, 0 replies; 6+ messages in thread
From: Philip Herron @ 2009-09-28 15:45 UTC (permalink / raw)
  To: Brian Budge; +Cc: mjk78, gcc-help

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brian Budge wrote:
> Hi -
>
> You should really send an email to the gnu make list.  This list is
>  for gcc questions.
>
> Brian
>
> On Mon, Sep 28, 2009 at 6:32 AM, mjk78 <shick3n@gmail.com> wrote:
>> I've taken over someone else's project code which uses #defines
>> to select which region the code is being compiled for.  Instead
>> of hard-coding these #defines, i would like to edit the makefile
>> to specify the region at compile time.
>>
>> ie. I would like to be able to enter "make USA" or "make Mexico"
>> and have that automatically define REG_UNITED STATES or
>> REG_MEXICO when compiling.
>>
>> I've tried to check the MAKECMDGOALS variable, but I still get a
>> "No rule to make target "USA". Stop" error.
Autoconf would be a good solution for this to make a config.h is what
you want.
>>
>> my makefile currently is:
>>
----------------------------------------------------------------------------------------
>>
>>
>>
>> ################################################### # Define
>> Project name ###################################################
>> PRJ_NAME=OTB SVN_REV=0 MODEL_NAME=EON-XCOM SUBVERSION=0
>>
>> OBJDIR=obj SRCDIR=source INCDIR=inc LSTDIR=list
>>
>> ###################################################
>> ###################################################
>> START_OF_SRAM=0x800000 #START_OF_SRAM=0x00814000
>> SIZE_OF_SRAM=1024k START_OF_FLASH=0x01100000
>>
>> # Must be 6 HEX digit START_OF_PROTECTED=000000
>> #END_OF_PROTECTED=00FFFF END_OF_PROTECTED=042400
>>
>> ################################################### # Source file
>> list ###################################################
>> C_SRC=$(notdir $(wildcard $(SRCDIR)/*.c)) A_SRC=$(notdir
>> $(wildcard $(SRCDIR)/*.s))
>>
>> ################################################### # Gen object
>> file name automatically
>> ###################################################
>> C_OBJ=$(addprefix $(OBJDIR)/, $(C_SRC:.c=.o)) A_OBJ=$(addprefix
>> $(OBJDIR)/, $(A_SRC:.s=.o))
>>
>> OUT_FILE=$(PRJ_NAME) BIN_FILE=$(PRJ_NAME).bin
>> TMS_FILE=$(PRJ_NAME).tms SCRIPT_FILE=$(PRJ_NAME).ld
>>
>> MAP_FILE=$(PRJ_NAME).map
>>
>>
>> ################################################### # Tools setup
>>  ###################################################
>> CROSS=arm-unknown-linux-gnu- LIBCDIR=/opt/lib_arm
>>
>> LIBSYSDIR=../lib
>>
>> INCLUDES=-I $(INCDIR) -I $(LIBSYSDIR) DEFINES=-D__NO_CTYPE
>> -DSVN_REV=$(SVN_REC) -D__pcs=
>>
>> #-------------------------------------------------- #Check for
>> USA, RSA or MEX command line arguments...MK
>> #-------------------------------------------------- ifeq
>> ($(MAKECMDGOALS),USA) REG_DEFINE=-DREG_UNITED_STATES endif ifeq
>> ($(MAKECMDGOALS),Mexico) REG_DEFINE=-DREG_MEXICO endif
>>
>>
>> CC=$(CROSS)gcc CFLAGS=-c -std=gnu89 -Os -Wall -msoft-float
>> -mthumb -mthumb-interwork -mcpu=arm7tdmi $(DEFINES) $(INCLUDES)
>> $(REG_DEFINE)
>>
>> ASM=$(CROSS)gcc ASFLAGS=$(CFLAGS)
>>
>> LINK=$(CROSS)ld LFLAGS=-nostdlib -L $(LIBCDIR)/lib -L
>> $(LIBSYSDIR) -static -T $(SCRIPT_FILE) -Map $(MAP_FILE)
>> LIBS=-lgcc -lc -lm -lsyscall -lsysutil
>>
>> AR=$(CROSS)ar ARFLAGS=-rc
>>
>> OBJCOPY=$(CROSS)objcopy OCFLAGS=-S -O binary
>>
>> BIN2TMS=bin2tms TMSFLAGS=-s$(SUBVERSION) -m$(MODEL_NAME)
>> -n$(PRJ_NAME) -x XXXX XX XX $(START_OF_PROTECTED)
>> $(END_OF_PROTECTED)
>>
>>
############################################################################
>>  # Loader config
>>
############################################################################
>>  LOADER=ConLoader LOADER_KEY=734EC4FF38F93130 LOADER_COM=6
>> LOADER_BAUD=115200 LOADER_AID=COMM_EXP
>>
>>
############################################################################
>>  # Linker script
>>
############################################################################
>>  LD_SCRIPT="     ENTRY (cstartup) \ SECTIONS {      \
>> _start_of_data = $(START_OF_SRAM); \ _start_of_flash =
>> $(START_OF_FLASH); \ _end_of_sram = _start_of_data +
>> $(SIZE_OF_SRAM); \ _start_of_header = _start_of_flash + 0x20; \
>> _start_of_app = _start_of_flash + 0x30; \ . = _start_of_flash; \
>> .startup : { *(sect_startup) } \ . = _start_of_header; \ .header
>> : { *(sect_header) } \ . = _start_of_app; \ .text : { *(.text
>> .glue*) } \ .const : { *(.rodata*) } \ _end_of_app = (. + 3) & ~
>> 3; \ . = _start_of_data; \ .data : AT (_end_of_app) { *(.data) }
>> \ _end_of_data = (. + 3) & ~ 3; \ . = _end_of_data; \
>> _start_of_bss = .; \ .bss : { *(.bss) } \ _end_of_bss = .; \
>> _end_of_flash = _end_of_app + SIZEOF (.data); \ }"
>>
>> ################################################### # Link file
>> ################################################### $(OUT_FILE) :
>> $(A_OBJ) $(C_OBJ) @echo . @echo [$(OUT_FILE)] @rm -f
>> $(SCRIPT_FILE) @echo $(LD_SCRIPT) > $(SCRIPT_FILE) @$(LINK)
>> $(LFLAGS) -o $(OUT_FILE) --start-group $(LIBS) $(A_OBJ) $(C_OBJ)
>> --end-group @rm -f $(SCRIPT_FILE) @$(OBJCOPY) $(OCFLAGS)
>> $(OUT_FILE) $(BIN_FILE) @$(BIN2TMS) $(TMSFLAGS) $(BIN_FILE)
>>
>> ###################################################
>> ###################################################
>> $(SRCDIR)/%.rc : $(INCDIR)/rc.h @touch $(SRCDIR)/$(@F)
>>
>> $(SRCDIR)/%.cpp : $(INCDIR)/%.h @touch $(SRCDIR)/$(@F)
>>
>> $(SRCDIR)/%.c : $(INCDIR)/%.h @touch $(SRCDIR)/$(@F)
>>
>> ################################################### # Compile C
>> files ###################################################
>> $(OBJDIR)/%.o : $(SRCDIR)/%.c @echo [$<] @$(CC) $(CFLAGS) $< -o
>> $@ -Wa,-a=$(LSTDIR)/$(@F:.o=.lst)
>>
>> ################################################### # Assembly
>> ASM files ###################################################
>> $(OBJDIR)/%.o : $(SRCDIR)/%.s @echo [$<] @$(ASM) $(ASFLAGS) $< -o
>> $@ -Wa,-a=$(LSTDIR)/$(@F:.o=.lst)
>>
>> ################################################### # Load
>> ################################################### .PHONY : load
>>  load : @echo $(LOADER_AID) > uniload.inf @$(LOADER) $(TMS_FILE)
>> -s$(LOADER_BAUD) -K$(LOADER_KEY) -$(LOADER_COM) @rm -f
>> uniload.inf
>>
>> ################################################### # Clear all
>> object file and output file
>> ################################################### .PHONY :
>> clean clean : @echo Delete all object file. @rm -f $(OBJDIR)/*.*
>> @rm -f $(LSTDIR)/*.* @rm -f $(OUT_FILE) @rm -f $(BIN_FILE) @rm -f
>> $(TMS_FILE) @rm -f $(MAP_FILE) @rm -f $(SCRIPT_FILE)
>>
>> -- View this message in context:
>> http://www.nabble.com/makefile-help-tp25645182p25645182.html Sent
>> from the gcc - Help mailing list archive at Nabble.com.
>>
>>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrA2gIACgkQAhcOgIaQQ2FLVgCdF9BGLvppOmQvsGgQA6BoQXlM
w9cAn36ObWnl1QpX7y1uIqbONpIyyzJP
=Rew2
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: makefile help
  2009-09-28 13:32 makefile help mjk78
@ 2009-09-28 13:43 ` Brian Budge
  2009-09-28 15:45   ` Philip Herron
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Budge @ 2009-09-28 13:43 UTC (permalink / raw)
  To: mjk78; +Cc: gcc-help

Hi -

You should really send an email to the gnu make list.  This list is
for gcc questions.

  Brian

On Mon, Sep 28, 2009 at 6:32 AM, mjk78 <shick3n@gmail.com> wrote:
>
> I've taken over someone else's project code which uses #defines to select
> which region the code is being compiled for.  Instead of hard-coding these
> #defines, i would like to edit the makefile to specify the region at compile
> time.
>
> ie. I would like to be able to enter "make USA" or "make Mexico" and have
> that automatically define REG_UNITED STATES or REG_MEXICO when compiling.
>
> I've tried to check the MAKECMDGOALS variable, but I still get a "No rule to
> make target "USA". Stop" error.
>
> my makefile currently is:
> ----------------------------------------------------------------------------------------
>
>
> ###################################################
> # Define Project name
> ###################################################
> PRJ_NAME=OTB
> SVN_REV=0
> MODEL_NAME=EON-XCOM
> SUBVERSION=0
>
> OBJDIR=obj
> SRCDIR=source
> INCDIR=inc
> LSTDIR=list
>
> ###################################################
> ###################################################
> START_OF_SRAM=0x800000
> #START_OF_SRAM=0x00814000
> SIZE_OF_SRAM=1024k
> START_OF_FLASH=0x01100000
>
> # Must be 6 HEX digit
> START_OF_PROTECTED=000000
> #END_OF_PROTECTED=00FFFF
> END_OF_PROTECTED=042400
>
> ###################################################
> # Source file list
> ###################################################
> C_SRC=$(notdir $(wildcard $(SRCDIR)/*.c))
> A_SRC=$(notdir $(wildcard $(SRCDIR)/*.s))
>
> ###################################################
> # Gen object file name automatically
> ###################################################
> C_OBJ=$(addprefix $(OBJDIR)/, $(C_SRC:.c=.o))
> A_OBJ=$(addprefix $(OBJDIR)/, $(A_SRC:.s=.o))
>
> OUT_FILE=$(PRJ_NAME)
> BIN_FILE=$(PRJ_NAME).bin
> TMS_FILE=$(PRJ_NAME).tms
> SCRIPT_FILE=$(PRJ_NAME).ld
>
> MAP_FILE=$(PRJ_NAME).map
>
>
> ###################################################
> # Tools setup
> ###################################################
> CROSS=arm-unknown-linux-gnu-
> LIBCDIR=/opt/lib_arm
>
> LIBSYSDIR=../lib
>
> INCLUDES=-I $(INCDIR) -I $(LIBSYSDIR)
> DEFINES=-D__NO_CTYPE -DSVN_REV=$(SVN_REC) -D__pcs=
>
> #--------------------------------------------------
> #Check for USA, RSA or MEX command line arguments...MK
> #--------------------------------------------------
> ifeq ($(MAKECMDGOALS),USA)
>     REG_DEFINE=-DREG_UNITED_STATES
> endif
> ifeq ($(MAKECMDGOALS),Mexico)
>     REG_DEFINE=-DREG_MEXICO
> endif
>
>
> CC=$(CROSS)gcc
> CFLAGS=-c -std=gnu89 -Os -Wall -msoft-float -mthumb -mthumb-interwork
> -mcpu=arm7tdmi $(DEFINES) $(INCLUDES) $(REG_DEFINE)
>
> ASM=$(CROSS)gcc
> ASFLAGS=$(CFLAGS)
>
> LINK=$(CROSS)ld
> LFLAGS=-nostdlib -L $(LIBCDIR)/lib -L $(LIBSYSDIR) -static -T $(SCRIPT_FILE)
> -Map $(MAP_FILE)
> LIBS=-lgcc -lc -lm -lsyscall -lsysutil
>
> AR=$(CROSS)ar
> ARFLAGS=-rc
>
> OBJCOPY=$(CROSS)objcopy
> OCFLAGS=-S -O binary
>
> BIN2TMS=bin2tms
> TMSFLAGS=-s$(SUBVERSION) -m$(MODEL_NAME) -n$(PRJ_NAME) -x XXXX XX XX
> $(START_OF_PROTECTED) $(END_OF_PROTECTED)
>
> ############################################################################
> # Loader config
> ############################################################################
> LOADER=ConLoader
> LOADER_KEY=734EC4FF38F93130
> LOADER_COM=6
> LOADER_BAUD=115200
> LOADER_AID=COMM_EXP
>
> ############################################################################
> # Linker script
> ############################################################################
> LD_SCRIPT="     ENTRY (cstartup) \
>                        SECTIONS {      \
>                                _start_of_data = $(START_OF_SRAM); \
>                                _start_of_flash = $(START_OF_FLASH); \
>                                _end_of_sram = _start_of_data + $(SIZE_OF_SRAM); \
>                                _start_of_header = _start_of_flash + 0x20; \
>                                _start_of_app = _start_of_flash + 0x30; \
>                                . = _start_of_flash; \
>                                .startup : { *(sect_startup) } \
>                                . = _start_of_header; \
>                                .header : { *(sect_header) } \
>                                . = _start_of_app; \
>                                .text : { *(.text .glue*) } \
>                                .const : { *(.rodata*) } \
>                                _end_of_app = (. + 3) & ~ 3; \
>                                . = _start_of_data; \
>                                .data : AT (_end_of_app) { *(.data) } \
>                                _end_of_data = (. + 3) & ~ 3; \
>                                . = _end_of_data; \
>                                _start_of_bss = .; \
>                                .bss : { *(.bss) } \
>                                _end_of_bss = .; \
>                                _end_of_flash = _end_of_app + SIZEOF (.data); \
>                        }"
>
> ###################################################
> # Link file
> ###################################################
> $(OUT_FILE) : $(A_OBJ) $(C_OBJ)
>        @echo .
>        @echo [$(OUT_FILE)]
>        @rm -f $(SCRIPT_FILE)
>        @echo $(LD_SCRIPT) > $(SCRIPT_FILE)
>        @$(LINK) $(LFLAGS) -o $(OUT_FILE) --start-group $(LIBS) $(A_OBJ) $(C_OBJ)
> --end-group
>        @rm -f $(SCRIPT_FILE)
>        @$(OBJCOPY) $(OCFLAGS) $(OUT_FILE) $(BIN_FILE)
>        @$(BIN2TMS) $(TMSFLAGS) $(BIN_FILE)
>
> ###################################################
> ###################################################
> $(SRCDIR)/%.rc : $(INCDIR)/rc.h
>        @touch $(SRCDIR)/$(@F)
>
> $(SRCDIR)/%.cpp : $(INCDIR)/%.h
>        @touch $(SRCDIR)/$(@F)
>
> $(SRCDIR)/%.c : $(INCDIR)/%.h
>        @touch $(SRCDIR)/$(@F)
>
> ###################################################
> # Compile C files
> ###################################################
> $(OBJDIR)/%.o : $(SRCDIR)/%.c
>        @echo [$<]
>        @$(CC) $(CFLAGS) $< -o $@ -Wa,-a=$(LSTDIR)/$(@F:.o=.lst)
>
> ###################################################
> # Assembly ASM files
> ###################################################
> $(OBJDIR)/%.o : $(SRCDIR)/%.s
>        @echo [$<]
>        @$(ASM) $(ASFLAGS) $< -o $@ -Wa,-a=$(LSTDIR)/$(@F:.o=.lst)
>
> ###################################################
> # Load
> ###################################################
> .PHONY : load
> load :
>        @echo $(LOADER_AID) > uniload.inf
>        @$(LOADER) $(TMS_FILE) -s$(LOADER_BAUD) -K$(LOADER_KEY) -$(LOADER_COM)
>        @rm -f uniload.inf
>
> ###################################################
> # Clear all object file and output file
> ###################################################
> .PHONY : clean
> clean :
>        @echo Delete all object file.
>        @rm -f $(OBJDIR)/*.*
>        @rm -f $(LSTDIR)/*.*
>        @rm -f $(OUT_FILE)
>        @rm -f $(BIN_FILE)
>        @rm -f $(TMS_FILE)
>        @rm -f $(MAP_FILE)
>        @rm -f $(SCRIPT_FILE)
>
> --
> View this message in context: http://www.nabble.com/makefile-help-tp25645182p25645182.html
> Sent from the gcc - Help mailing list archive at Nabble.com.
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* makefile help
@ 2009-09-28 13:32 mjk78
  2009-09-28 13:43 ` Brian Budge
  0 siblings, 1 reply; 6+ messages in thread
From: mjk78 @ 2009-09-28 13:32 UTC (permalink / raw)
  To: gcc-help


I've taken over someone else's project code which uses #defines to select
which region the code is being compiled for.  Instead of hard-coding these
#defines, i would like to edit the makefile to specify the region at compile
time.

ie. I would like to be able to enter "make USA" or "make Mexico" and have
that automatically define REG_UNITED STATES or REG_MEXICO when compiling.

I've tried to check the MAKECMDGOALS variable, but I still get a "No rule to
make target "USA". Stop" error.

my makefile currently is:
----------------------------------------------------------------------------------------


###################################################
# Define Project name
###################################################
PRJ_NAME=OTB
SVN_REV=0
MODEL_NAME=EON-XCOM
SUBVERSION=0

OBJDIR=obj
SRCDIR=source
INCDIR=inc
LSTDIR=list

###################################################
###################################################
START_OF_SRAM=0x800000
#START_OF_SRAM=0x00814000
SIZE_OF_SRAM=1024k
START_OF_FLASH=0x01100000

# Must be 6 HEX digit
START_OF_PROTECTED=000000
#END_OF_PROTECTED=00FFFF
END_OF_PROTECTED=042400

###################################################
# Source file list
###################################################
C_SRC=$(notdir $(wildcard $(SRCDIR)/*.c))
A_SRC=$(notdir $(wildcard $(SRCDIR)/*.s))

###################################################
# Gen object file name automatically
###################################################
C_OBJ=$(addprefix $(OBJDIR)/, $(C_SRC:.c=.o))
A_OBJ=$(addprefix $(OBJDIR)/, $(A_SRC:.s=.o))

OUT_FILE=$(PRJ_NAME)
BIN_FILE=$(PRJ_NAME).bin
TMS_FILE=$(PRJ_NAME).tms
SCRIPT_FILE=$(PRJ_NAME).ld

MAP_FILE=$(PRJ_NAME).map


###################################################
# Tools setup
###################################################
CROSS=arm-unknown-linux-gnu-
LIBCDIR=/opt/lib_arm

LIBSYSDIR=../lib

INCLUDES=-I $(INCDIR) -I $(LIBSYSDIR)
DEFINES=-D__NO_CTYPE -DSVN_REV=$(SVN_REC) -D__pcs=

#--------------------------------------------------
#Check for USA, RSA or MEX command line arguments...MK
#--------------------------------------------------
ifeq ($(MAKECMDGOALS),USA)
     REG_DEFINE=-DREG_UNITED_STATES
endif
ifeq ($(MAKECMDGOALS),Mexico)
     REG_DEFINE=-DREG_MEXICO
endif


CC=$(CROSS)gcc
CFLAGS=-c -std=gnu89 -Os -Wall -msoft-float -mthumb -mthumb-interwork
-mcpu=arm7tdmi $(DEFINES) $(INCLUDES) $(REG_DEFINE)

ASM=$(CROSS)gcc
ASFLAGS=$(CFLAGS)

LINK=$(CROSS)ld
LFLAGS=-nostdlib -L $(LIBCDIR)/lib -L $(LIBSYSDIR) -static -T $(SCRIPT_FILE)
-Map $(MAP_FILE)
LIBS=-lgcc -lc -lm -lsyscall -lsysutil

AR=$(CROSS)ar
ARFLAGS=-rc

OBJCOPY=$(CROSS)objcopy
OCFLAGS=-S -O binary

BIN2TMS=bin2tms
TMSFLAGS=-s$(SUBVERSION) -m$(MODEL_NAME) -n$(PRJ_NAME) -x XXXX XX XX
$(START_OF_PROTECTED) $(END_OF_PROTECTED)

############################################################################
# Loader config
############################################################################
LOADER=ConLoader
LOADER_KEY=734EC4FF38F93130
LOADER_COM=6
LOADER_BAUD=115200
LOADER_AID=COMM_EXP

############################################################################
# Linker script
############################################################################
LD_SCRIPT="	ENTRY (cstartup) \
			SECTIONS {	\
				_start_of_data = $(START_OF_SRAM); \
				_start_of_flash = $(START_OF_FLASH); \
				_end_of_sram = _start_of_data + $(SIZE_OF_SRAM); \
				_start_of_header = _start_of_flash + 0x20; \
				_start_of_app = _start_of_flash + 0x30; \
				. = _start_of_flash; \
				.startup : { *(sect_startup) } \
				. = _start_of_header; \
				.header : { *(sect_header) } \
				. = _start_of_app; \
				.text : { *(.text .glue*) } \
				.const : { *(.rodata*) } \
				_end_of_app = (. + 3) & ~ 3; \
				. = _start_of_data; \
				.data : AT (_end_of_app) { *(.data) } \
				_end_of_data = (. + 3) & ~ 3; \
				. = _end_of_data; \
				_start_of_bss = .; \
				.bss : { *(.bss) } \
				_end_of_bss = .; \
				_end_of_flash = _end_of_app + SIZEOF (.data); \
			}"

###################################################
# Link file
###################################################
$(OUT_FILE) : $(A_OBJ) $(C_OBJ)
	@echo .
	@echo [$(OUT_FILE)]
	@rm -f $(SCRIPT_FILE)
	@echo $(LD_SCRIPT) > $(SCRIPT_FILE)
	@$(LINK) $(LFLAGS) -o $(OUT_FILE) --start-group $(LIBS) $(A_OBJ) $(C_OBJ)
--end-group
	@rm -f $(SCRIPT_FILE)
	@$(OBJCOPY) $(OCFLAGS) $(OUT_FILE) $(BIN_FILE)
	@$(BIN2TMS) $(TMSFLAGS) $(BIN_FILE)

###################################################
###################################################
$(SRCDIR)/%.rc : $(INCDIR)/rc.h
	@touch $(SRCDIR)/$(@F)
	
$(SRCDIR)/%.cpp : $(INCDIR)/%.h
	@touch $(SRCDIR)/$(@F)
	
$(SRCDIR)/%.c : $(INCDIR)/%.h
	@touch $(SRCDIR)/$(@F)

###################################################
# Compile C files
###################################################
$(OBJDIR)/%.o : $(SRCDIR)/%.c
	@echo [$<]
	@$(CC) $(CFLAGS) $< -o $@ -Wa,-a=$(LSTDIR)/$(@F:.o=.lst)

###################################################
# Assembly ASM files
###################################################
$(OBJDIR)/%.o : $(SRCDIR)/%.s
	@echo [$<]
	@$(ASM) $(ASFLAGS) $< -o $@ -Wa,-a=$(LSTDIR)/$(@F:.o=.lst)

###################################################
# Load
###################################################
.PHONY : load
load :
	@echo $(LOADER_AID) > uniload.inf
	@$(LOADER) $(TMS_FILE) -s$(LOADER_BAUD) -K$(LOADER_KEY) -$(LOADER_COM)
	@rm -f uniload.inf

###################################################
# Clear all object file and output file
###################################################
.PHONY : clean
clean :
	@echo Delete all object file.
	@rm -f $(OBJDIR)/*.*
	@rm -f $(LSTDIR)/*.*
	@rm -f $(OUT_FILE)
	@rm -f $(BIN_FILE)
	@rm -f $(TMS_FILE)
	@rm -f $(MAP_FILE)
	@rm -f $(SCRIPT_FILE)

-- 
View this message in context: http://www.nabble.com/makefile-help-tp25645182p25645182.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* makefile help
@ 2000-07-14  3:18 Mahadev Cholachgudda
  0 siblings, 0 replies; 6+ messages in thread
From: Mahadev Cholachgudda @ 2000-07-14  3:18 UTC (permalink / raw)
  To: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

hi,
 
in the makefile i want to change the working 
directory itself. and further commands should be run from that directory. is it 
possible }
 
for eg.
 
#pwd is c:/tmp
chdir c:/tmp/test
 
cc 
test.c        # the test.c file exists in the 
c:/tmp/test directory.
 
 
any idea how to do this ?
 
 
thanks in advance,
 
mahadev

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-09-28 15:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-15  7:13 Makefile Help Rich
2002-03-15  8:05 ` Kayvan A. Sylvan
  -- strict thread matches above, loose matches on Subject: below --
2009-09-28 13:32 makefile help mjk78
2009-09-28 13:43 ` Brian Budge
2009-09-28 15:45   ` Philip Herron
2000-07-14  3:18 Mahadev Cholachgudda

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).