Make error


 
Thread Tools Search this Thread
Top Forums Programming Make error
# 1  
Old 11-22-2009
Make error

Hello,

Is someone know why this generate an error :

Code:
all:
    dt = $(shell date)
    echo "$(dt)"

# 2  
Old 11-23-2009
what error?
# 3  
Old 11-23-2009
Which make? GNU, BSD, Solaris, HP-UX, ...?
# 4  
Old 11-23-2009
subshell and p.e.

hello in bash () denotes a subshell
in your case dt is a shell variable and not a process so you cant embed it in ( )
use {} instead aka p.e. (parameter expansion)
all:
dt = $(shell date)
echo "${dt}"

Hope this helps.
# 5  
Old 11-23-2009
Hi.

There are 3 parts to a rule: target, dependencies, commands. The commands are, essentially, shell commands. For example:
Code:
#!/usr/bin/env bash

# @(#) s1	Demonstrate commands for a rule.

echo
set +o nounset
LC_ALL=C ; LANG=C ; export LC_ALL LANG
echo "Environment: LC_ALL = $LC_ALL, LANG = $LANG"
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version "=o" $(_eat $0 $1) make
set -o nounset
echo

FILE=${1-Makefile}

echo " Data file $FILE:"
cat $FILE

echo
echo " Results:"
make

exit 0

producing:
Code:
% ./s1

Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution        : Debian GNU/Linux 5.0 
GNU bash 3.2.39
GNU Make 3.81

 Data file Makefile:

# 2009.11.23 / Demonstration Makefile for setting variable with
# date.

t1 = $(shell date)
all:
	echo t1 set to $(t1)

 Results:
echo t1 set to Mon Nov 23 20:06:24 CST 2009
t1 set to Mon Nov 23 20:06:24 CST 2009

In your Makfile snippet, the
Code:
dt = ..

is taken as a command, which it clearly is not.

So in addition to the parts of a rule, it would be good to learn that you can help others help you by posting the exact error message, and often the version of the program you are using.

Best wishes ... cheers, drl
# 6  
Old 11-24-2009
Quote:
Originally Posted by gaurav1086
hello in bash () denotes a subshell
in your case dt is a shell variable and not a process so you cant embed it in ( )
use {} instead aka p.e. (parameter expansion)
all:
dt = $(shell date)
echo "${dt}"

Hope this helps.
It not works, using GNU make.
Quote:
/bin/sh: Syntax error: "(" unexpected
I solved with that :
Code:
all:
    dt=$$(date) && echo $$dt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Make cmake_check_build_system error 1

......... (1 Reply)
Discussion started by: larry burns
1 Replies

2. UNIX Desktop Questions & Answers

Gtkmm Make Then Error

I would like to install gtkmm-2.0.1 on solaris 10 platform. To install, I have a dependency libsigc++1.2 successfully install. I can type ./configure without any error. But when I typed make I got the following error. I am newbie who cannot understand the error. Have no idea how to solve... (0 Replies)
Discussion started by: nirin
0 Replies

3. Linux

Error when using make file.

hello, i want to execute hello world using cross compiler ppc_4xx-gcc. i have this makefile: CC= $(shell which ppc_4xx-gcc) #CC=g++ CXXFLAGS=-cpp -Wall LDFLAGS= SOURCES=main.cpp hello.h OBJECTS=$(SOURCES:.cpp=.o) EXECUTABLE=hello all: $(SOURCES)... (5 Replies)
Discussion started by: walidaydi
5 Replies

4. Shell Programming and Scripting

Make file error

I am new to using make command and I keep getting this error time and again please help me Make file is as follows #ARCH := $(shell uname)# # ifeq ($(ARCH), SunOS) DEFINES = -KPIC -DSVR4 -DSOLARIS -DSYSV -D__svr4 -D__svr4__\ -D_REENTRANT -DSOLARIS2_5 -D_SVID_GETTOD -DXP_UNIX -UDEBUG... (1 Reply)
Discussion started by: c.operatingsys
1 Replies

5. Programming

Error with Make File

Hi All, I am using GNU Make and i have a peculiar kind of error, i am not able to understand, Firstly have a look at the make file used by me CFLAGS=-c -Wall CC=gcc .PHONY:clean OBJ=./obj SRC=./src INC=./inc exec: $(OBJ)/*.o $(CC) $^ -o $@ %.o: $(SRC)/*.c $(CC) $(CFLAGS)... (1 Reply)
Discussion started by: niranjanvg
1 Replies

6. Solaris

Gani Network Driver Won't Install - make: Fatal error: Don't know how to make targ...

I attached a README file that I will refer to. I successfully completed everything in the README file until step 4. # pwd /gani/gani-2.4.4 # ls COPYING Makefile.macros gem.c Makefile Makefile.sparc_gcc gem.h Makefile.amd64_gcc ... (1 Reply)
Discussion started by: Bradj47
1 Replies

7. UNIX for Advanced & Expert Users

make[2]: *** [xml] Error 1

Hi, I am trying to build an rpm on redhat machine. OS:Red Hat Enterprise Linux ES release 4 (Nahant Update 6) after building when I try to install,after doing the 'configure' command, when I run 'make',, its giving the following error. # make make all-recursive make: Entering... (1 Reply)
Discussion started by: praveen_b744
1 Replies

8. Linux

Error in issuing a make and make install

Hi, Recently I install a package and try to do a make and make install. However, in the make it gives me below error:- make:Nothing to be done for 'install-exec-am' make:Nothing to be done for 'install-data-am' Can anyone please explain to me what does this mean? I have been trying... (1 Reply)
Discussion started by: ahjiefreak
1 Replies

9. UNIX for Advanced & Expert Users

gcc & make error- Help please

Folks; I'm trying to install gcc-3.4.6 & install SWIG tool on Solaris 10 (Sparc), but when i try to run make for gcc i got this error below: make: Fatal error: Command failed for target `all-gcc' and when i try to run "make install" to install swig, i got this error: *** Error code 2... (10 Replies)
Discussion started by: moe2266
10 Replies

10. Programming

Error when running make

Hi , I get the following error when i run the make command. cc -Aa -DUNIX -osrcmpmn srcmpmn.c crt0: ERROR couldn't open /usr/lib/dld.sl errno:000000014 *** Error exit code 14 here the file is C program which has been modified. Please help. (1 Reply)
Discussion started by: shashidhara_01
1 Replies
Login or Register to Ask a Question