make file - linking


 
Thread Tools Search this Thread
Top Forums Programming make file - linking
# 1  
Old 05-25-2007
make file - linking

Hi,

I have written a makefile and am facing some problem in linking..
This is the first makefile i write.. i think that am just compiling all the .c files and not linking the object files.. can anybody tell me how to link all the .o files???


When i do make all i am getting the following error:

/usr/bin/gcc -c -g -O2 -ansi -Wall -D_REENTRANT -D_POSIX_C_SOURCE=199309L -I./inc src -o all
gcc: src: linker input file unused because linking not done


Code:
CROSS_COMPILE   = /usr/bin/

AS      = $(CROSS_COMPILE)as
AR      = $(CROSS_COMPILE)ar
LD      = $(CROSS_COMPILE)ld
CC      = $(CROSS_COMPILE)gcc

PRINT   = /bin/echo

SRCS    = $(wildcard *.c)
OBJS    = $(SRCS:%.c=%.o)
BASEDIR = $(HOME)/Projects_latest
TOPDIR = $(BASEDIR)/voip/ip_phone/source/sys_test/app/hs1x0/hs110/inc
#Subdirectories of source code

SUBDIR = ./src
.PHONY: clean

VPATH = ./inc
CFLAGS = -c -g -O2 -ansi -Wall -D_REENTRANT -POSIX_C_SOURCE=199309L

CFLAGS += $(patsubst %, -I% , $(VPATH))

all: $(addsuffix $(SRCS) , $(SUBDIR))
        $(CC) $(CFLAGS) $< -o $@

# 2  
Old 05-26-2007
gcc -c means "do not link, create an object file instead" (a .o output file named like: file.o)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

2. Shell Programming and Scripting

How to make multiple small file out of a single file?

Hi, I have a file that consist of around six million line, now the task is to divide this file into 12 small file so that each file would have half a million lines in it. Thanks. (3 Replies)
Discussion started by: mukulverma2408
3 Replies

3. UNIX for Dummies Questions & Answers

Help needed, linking to file in different sub-folder

Hello, I'd really like some help on this, a PERL-CGI script (complete working script is below). How can I add the server's root folder (folder_f) to this: ~ s/_e\.shtml/_f\.shtml/ This bit of code searches all occurences of _e.shtml and replaces them with _f.shtml (it being in the same... (1 Reply)
Discussion started by: fredfletcher
1 Replies

4. Shell Programming and Scripting

how to make my own file as a running log file in bash

Hi, I have written a small script from that iam appending the output to a file.If multiple users invoke the same script or if i invoke the same script n number of times (using &), the output file(ZZ/OUT) contains messup information. #!/bin/bash # echo "Hello" >> /tmp/ZZ/OUT sleep 10 echo... (4 Replies)
Discussion started by: blrguest
4 Replies

5. Programming

makeutility: how to get the make-file name inside of the make-file?

How I can get the current make-file name in a make-file So, if I run make with specified file:make -f target.mak is it possible to have the 'target' inside of the that 'target.mak' from the file name? (2 Replies)
Discussion started by: alex_5161
2 Replies

6. UNIX for Dummies Questions & Answers

is linking possible?

how would i link 2 files together? is it the same as copying? (1 Reply)
Discussion started by: trob
1 Replies

7. Shell Programming and Scripting

compare two files and make 1st file same as 2nd file

I am trying to compare two file and make changes where ever its different. for example: Contents of file1 IP=192.165.89.11 NM=255.255.0.0 GW=192.165.89.1 Contents of file2 IP=192.165.89.11 NM=255.255.255.255 GW=192.165.89.1 NOTE HERE THAT NM IS DIFFERENT So i want the changes... (6 Replies)
Discussion started by: pradeepreddy
6 Replies

8. UNIX for Dummies Questions & Answers

modifying C file and linking back to project files

hi, This is the first time I work in a big C project. All source code files are located in say directory /source/pp and all header files are in /include/pp. I've created a link to both of these directories from my home dir, say /home/ss. So in the /home/ss dir I have the /source/pp and /include/pp... (1 Reply)
Discussion started by: bruins2005
1 Replies

9. Programming

Linking problem while linking to shared library

Hi I'm getting ld: fatal: option -h and building a dynamic executable are incompatible ld: fatal: Flags processing errors When I run ld -shared -L/usr/dt/lib -lDtSvc -o builtin.so Workspace.o after running gcc -fPIC -I/usr/X11R6/include -I/usr/dt/include -c Workspace.c I'm... (6 Replies)
Discussion started by: laho
6 Replies

10. Shell Programming and Scripting

linking unix generated text file to html page

i am trying to link the text files that i generated from my shell script to an html page, to that i can view them using a browser, like internet explorer. i want to open the text files in html page when i enter a command to view the text file from the shell command. please could anyone help... (1 Reply)
Discussion started by: alexd
1 Replies
Login or Register to Ask a Question