Sponsored Content
Full Discussion: Makefile not work. Why?
Top Forums Programming Makefile not work. Why? Post 302169492 by grumpf on Thursday 21st of February 2008 12:38:44 PM
Old 02-21-2008
hi,
make file are processed from line 1 and the first lines of you file are variables (ok) but then a role
and soon this role is processed it stops.

All you need is in the begining

myprg: myprg.o mymodul.o

since make KNOWS how to generate a binary from an .o and KNOWS how to generate a .o from
several sources including .c this should work.


Quote:
Originally Posted by marcintom
Code:
[root@zet c1(0)]# ls
c1.0.cc  info  makefile  x.c
[root@zet c1(0)]# cat makefile 
CC=/usr/bin/g++                                       <- iff you have more than one , else gcc/g++ alone is sufficent 
CFLAGS=-pedantic -ansi                       <- -better -Wall
LFLAGS=                                              <- i guess you want LDFLAGS, not used so remove
#NAME=c1.0
AUTHOR= Marcin

%.o: %.c
        $(CC) $(CFLAGS) -c $<                           <- Make knows this  remove

%: %.cc 
        $(CC) $(CFLAGS) $*.cc $(LFLAGS) -o $*   <- Make knows this  remove

# to na wypadek gdyby pliki o tych nazwach istniały
.PHONY: clean info install

install:                                                                <- 1. real rule it will executed make will stop here
        @echo "Not implemented"

#clean:
#       rm -f $(NAME1) $(NAME2)                <- $(RM)       

info:
        @echo "$(AUTHOR)"
        @echo " GPL vRelease"
[root@zet c1(0)]# make
Not implemented
[root@zet c1(0)]#

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

2. Programming

Makefile

I am writing my first makefile, and I face a problem: all: sequential pthreads1 pthreads2 openmp1 openmp2 sequential: sequential/main.c sequential/definitions.h gcc -o seq sequential/main.c pthreads1: pthreads1/main.c pthreads1/definitions.h gcc -o pthr1 pthreads1/main.c -lpthread ... (0 Replies)
Discussion started by: myle
0 Replies

3. UNIX for Advanced & Expert Users

Makefile problem - How to run module load in a Makefile

Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error: make: module: command not found Why is this? Is there any way to run this command in a Makefile? NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Discussion started by: hernandinho
2 Replies

4. Shell Programming and Scripting

makefile

Hi, I have problem related to makefile in c in linux(ubuntu). What is the meaning of @prefix@ what this two @ symbols mean here? Thanks, Vivek (0 Replies)
Discussion started by: vivek146
0 Replies

5. Programming

[Makefile] nothing to be done for 'all'

hello, I have a firts makefile who call others makefile. for this i use: $ make -f linux.mak and output his: $ make -f linux.mak all make -C DerelictAL all PLATFORM=linux make: Entering directory `/home/builder/rpmbuild/SOURCES/derelict2-20100407/DerelictAL' make: Nothing to be done for... (2 Replies)
Discussion started by: bioinfornatics
2 Replies

6. UNIX for Advanced & Expert Users

Makefile executing another Makefile first?

I have 2 libraries in 2 different directories that I build with Makefiles. library B depends on library A. If I modify a .cpp file in library A and run lib B's Makefile can I have B's makefile to automatically rebuild library A? I am now rebuilding A, followed by B... but I'd like B to... (0 Replies)
Discussion started by: wwuster
0 Replies

7. Homework & Coursework Questions

Help with Simple Multi-Level Makefile (Extremely New at Makefile)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies

8. IP Networking

NIC will not work, but it did work.

I have a client machine that was built and loaded with SCO UNIX 2.1.3, (yes it is old). The machine worked fine on the closed network that I tested on in my shop. I then had to change it to the network that it would be connected to. Below is the host file, router and subnet mask file that I usually... (0 Replies)
Discussion started by: NC user
0 Replies

9. Shell Programming and Scripting

My script work on Linux but not work in sunos.

My script work on Linux but not work in sun os. my script. logFiles="sentLog1.log sentLog2.log" intial_time="0 0" logLocation="/usr/local/tomcat/logs/" sleepTime=600 failMessage=":: $(tput bold)Log not update$(tput rmso) = " successMessage="OK" arr=($logFiles)... (7 Replies)
Discussion started by: ooilinlove
7 Replies

10. IP Networking

Discussion at work, would a router work pluging a cable in wan1 and lan1?

hi all. and sorry for the random question, but this sparkled a raging flame-war at work and i want more points of view situation a router, with linux of some sort, dhcp client requesting for ip in wan1 (as usual with wan ports) dhcp server listening in lan1, and assigning ip (as usual... (9 Replies)
Discussion started by: broli
9 Replies
gccmakedep(1)						      General Commands Manual						     gccmakedep(1)

NAME
gccmakedep - create dependencies in makefiles using 'gcc -M' SYNOPSIS
gccmakedep [ -sseparator ] [ -fmakefile ] [ -a ] [ -- options -- ] sourcefile ... DESCRIPTION
The gccmakedep program calls 'gcc -M' to output makefile rules describing the dependencies of each sourcefile, so that make(1) knows which object files must be recompiled when a dependency has changed. By default, gccmakedep places its output in the file named makefile if it exists, otherwise Makefile. An alternate makefile may be speci- fied with the -f option. It first searches the makefile for a line beginning with # DO NOT DELETE or one provided with the -s option, as a delimiter for the dependency output. If it finds it, it will delete everything following this up to the end of the makefile and put the output after this line. If it doesn't find it, the program will append the string to the makefile and place the output after that. EXAMPLE
Normally, gccmakedep will be used in a makefile target so that typing 'make depend' will bring the dependencies up to date for the make- file. For example, SRCS = file1.c file2.c ... CFLAGS = -O -DHACK -I../foobar -xyz depend: gccmakedep -- $(CFLAGS) -- $(SRCS) OPTIONS
The program will ignore any option that it does not understand, so you may use the same arguments that you would for gcc(1), including -D and -U options to define and undefine symbols and -I to set the include path. -a Append the dependencies to the file instead of replacing existing dependencies. -fmakefile Filename. This allows you to specify an alternate makefile in which gccmakedep can place its output. Specifying "-" as the file name (that is, -f-) sends the output to standard output instead of modifying an existing file. -sstring Starting string delimiter. This option permits you to specify a different string for gccmakedep to look for in the makefile. The default is "# DO NOT DELETE". -- options -- If gccmakedep encounters a double hyphen (--) in the argument list, then any unrecognized arguments following it will be silently ignored. A second double hyphen terminates this special treatment. In this way, gccmakedep can be made to safely ignore esoteric compiler arguments that might normally be found in a CFLAGS make macro (see the EXAMPLE section above). -D, -I, and -U options appearing between the pair of double hyphens are still processed normally. SEE ALSO
gcc(1), make(1), makedepend(1). AUTHOR
The version of the gccmakedep included in this X.Org Foundation release was originally written by the XFree86 Project based on code sup- plied by Hongjiu Lu. Colin Watson wrote this manual page, originally for the Debian Project, based partly on the manual page for makedepend(1). X Version 11 gccmakedep 1.0.2 gccmakedep(1)
All times are GMT -4. The time now is 03:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy