Results 1 to 2 of 2
Hi, This isn't really Debian related but,
I'm trying to convert my makefile from OPUS to GNU and I'm having some problems. When I run make I get a few ...
- 05-26-2006 #1Just Joined!
- Join Date
- Nov 2005
- Posts
- 15
Help with GNU make
Hi, This isn't really Debian related but,
I'm trying to convert my makefile from OPUS to GNU and I'm having some problems. When I run make I get a few problems. Oh, I'm using 3.79.?? of make
First, I have a batch file that sets an environment variable and in the makefile, I try to use a conditional statement like:
ifeq ($(VAR), 0)
- <do something>
else
ifeq ($(VAR), 1)
- <do something>
else
$(error txt)
endif
endif
I always end up in the <error> part. It seems like I can't read the <VAR> correctly. Also, I tried to use:
ifeq (...)
else ifeq (...)
else
endif
but it seems that there is something wrong, it says, "..\makefile.ini:63: Extraneous text after `else' directive
..\makefile.ini:63: *** extraneous `else'. Stop."
What am I missing??
Thanks in advance
- 06-02-2006 #2Just Joined!
- Join Date
- Nov 2005
- Posts
- 15
I'm having some problems with the "ifeq" or the definition of variables. Here is my Makefile:
################################################## ########################
# Configuration Section
################################################## ########################
# Project name
PROJECT_NAME = KCHASSIS
# File deletion tool
RM = del /Q
# OS type
OS_TYPE=0 # 0: Nucleus, 1: ThreadX
# CPU type
CPU_TYPE=2 # 0: TX3927, 1: MPC8245, 2: MPC834X
# Compiler type
COMPILER_TYPE=0 # 0: Diab 1: Green Hill
# Input clock frequency
IN_CLK_FREQ=3 # 0 = 66MHz, 1 = 100MHz, 2 = 133MHz, 3 = 266MHz
# MMU type
MMU_TYPE=0 # 0 = BAT mode, 1 = Page mode
# Multiple runtime Image type
MRI=0 # 0 = Single Runtime, 1 = Multiple Runtime
################################################## ########################
# If-Else Section
################################################## ########################
ifeq "${RELEASE_MODE}" "0"
MODE_DEFINE = -DRUNTIME_DEBUG
else
ifeq "${RELEASE_MODE}" "1"
MODE_DEFINE = -DRUNTIME_RELEASE
else
$(error Release mode must be 0 (Debug mode) or 1 (Release mode). Now, it is ${RELEASE_MODE}.)
endif
endif
ifeq "$(OS_TYPE)" "0"
MODE_DEFINE += -DOS_NUCLEUS
else
ifeq "$(OS_TYPE)" "1"
MODE_DEFINE += -DOS_THREADX
else
$(error OS type must be 0 (Nucleus) or 1 (ThreadX). Now, it is $(OS_TYPE).)
endif
endif
ifeq "$(CPU_TYPE)" "0"
MODE_DEFINE += -DTX3927
else
ifeq "$(CPU_TYPE)" "1"
MODE_DEFINE += -DMPC8245
else
ifeq "$(CPU_TYPE)" "2"
MODE_DEFINE += -DMPC834X
else
$(error CPU type must be 0 (TX3927) or 1 (MPC8245) or 2 (MPC834x). Now, it is $(CPU_TYPE).)
endif
endif
endif
ifeq "$(COMPILER_TYPE)" "0"
MODE_DEFINE += -DDIAB
else
ifeq "$(COMPILER_TYPE)" "1"
MODE_DEFINE += -DGREENHILL
else
$(error Compiler type must be 0 (Diab) or 1 (Green Hill). Now, it is $(COMPILER_TYPE).)
endif
endif
MODE_DEFINE += -DDRAM_SIZE_256M
ifeq "$(IN_CLK_FREQ) "0"
MODE_DEFINE += -DIN_CLK_66MHZ
else
ifeq "$(IN_CLK_FREQ) "1"
MODE_DEFINE += -DIN_CLK_100MHZ
else
ifeq "$(IN_CLK_FREQ)" "2"
MODE_DEFINE += -DIN_CLK_133MHZ
else
ifeq "$(IN_CLK_FREQ)" "3"
MODE_DEFINE += -DIN_CLK_266MHZ
endif
endif
endif
endif
ifeq "$(MMU_TYPE)" "0"
MODE_DEFINE += -DMMU_BAT_MODE
else
ifeq "$(MMU_TYPE)" "1"
MODE_DEFINE += -DMMU_PAGE_MODE
else
$(error MMU type must be 0 (BAT mode) or 1 (Page mode). Now, it is $(MMU_TYPE).)
endif
endif
ifeq "$(MRI)" "0"
MODE_DEFINE += -DSINGLE_IMAGE
else
ifeq "$(MRI)" "1"
MODE_DEFINE += -DMULTIPLE_IMAGE
else
$(error Multiple Runtime Image type must be 0 (Single Image) or 1 (Multiple Image). Now, it is $(MRI).)
endif
endif
# USB support
MODE_DEFINE += -DUSB_SUPPORT -DCONFIG_USB_EHCI -DCONFIG_USB_STORAGE
# SD support
MODE_DEFINE += -DSD_SUPPORT
################################################## ###
# Project Directory
################################################## ###
# Project path definition
PROJECT_ROOT = \Project\$(PROJECT_NAME)\Runtime
# Compiler include files path definition
COMPILER_BASE = \compiler\diab\4.4b
# OS include files path definition
ifeq "$(CPU_TYPE)" "2"
OS_ROOT = \Project\Platform\NUCLEUS.834
else
OS_ROOT = \Project\Plaatform\NUCLEUS.824
endif
# Include files path definition
OS_INC = $(OS_ROOT)\h
COMPILER_INC = $(COMPILER_BASE)\include
# ATTACHE path definition
ATTACHE_INC = $(PROJECT_ROOT)\Attache\h
# Broadcom SDK path
SDK_INC = \Project\$(PROJECT_NAME)\BCM_SDK\firmware\include
# Project include path definition
INC_PATH = -I, -I.\h -I.\inc -I$(PROJECT_ROOT) -I$(OS_INC) -I$(COMPILER_INC)
# User custom path definiton
USER_DEF = -I$(ATTACHE_IN) -i$(SDK_INC)
################################################## ###
# Compiler & Assembler & Make section
################################################## ###
# Compiler and assembler define ara
CC = dcc # C Compiler
AS = das # Asserbler
AR = dar # Library generator
LD = dld # Linker
# Compiler flag definition
C_OPTION = -g -c -tPPC8240ES:simple -X35=0 -X8=2 -Xforce-prototypes -Xlint
# Assembler flag definition
S_OPTION = -g -tPPC8240ES:simple
# BCM SDK flag
BCM_SDK_OPTION = -D_SHR_PBMP_WIDTH=64
BCM_SDK_OPTION += -DDEBUG
BCM_SDK_OPTION += -DINCLUDE_MEM_SCAN
# C Compiler Flags
CFLAGS = $(C_OPTION) $(BCM_SDK_OPTION) $(MODE_DEFINE) $(INC_PATH) $(USER_DEF)
# Assembler Flags
SFLAGS = $(S_OPTION) $(MODE_DEFINE) -I.\inc
.RESPONSE.DAR : pre= suf=.rsp out=76 in=128 dar
.RESPONSE.LD : pre= suf=.rsp out=76 in=128 dld
.HDR.s = ^[ \t]*.[ \t]*include[ \t]+\(.*\)[ \t\#]*
.HDRPATH.c = .\h $(CFLAGS,M^[-/]I,S///)
.HDRPATH.s = .\h
.TYPE.c = .c
.TYPE.SRC = .c
.TYPE.OBJ = .o
.c.o :
$(CC) $(CFLAGS) -o o\\$(*F).o $<
$(AR) -ru .\$(LIB_FILE) o\$(*F).o
$(AR) -sR .\$(LIB_FILE)
.s.o :
$(AS) $(SFLAGS) -o o\\$(*F).o $<
and then this is what i see when I try to run make:
>make
Makefile.ini:59: *** OS type must be 0 (Nucleus) or 1 (ThreadX). Now, it is 0 .. Stop.
So Obviously it is reading the variable correctly, but why is the ifeq not working properly??
Sorry for long post
TIA


Reply With Quote
