Sponsored Content
Top Forums Shell Programming and Scripting Question in creating targets in makefile Post 302843976 by Anand Venkatesa on Friday 16th of August 2013 02:09:51 AM
Old 08-16-2013
Question Question about creating targets in makefile

Hi,

I have a question related to makefile. I'm new to makefile and I'm in the process of writing a makefile for my RBT build. I have multiple source files and when I compile them I will get multiple object files (one object file for each source file). I'm having problem in creating a target for each object file with out hardcoding the object file names. I read the list of source file names from another make file. Assume the variable SRC_NAMES contains list of source file names (say test1.c test2.c test3.c). Now I want to create target for each objects for it (say test1.obj test2.obj test3.obj). Currently I have written some thing like below,

Code:
 
#############################################
OBJS_LIST := $(foreach file,$(SRC_NAMES),$(notdir ${file}))
OBJS_LIST := $(DSP_COMMON_OBJ_LIST:.c=.obj)
 
all: final.exe
 
final.exe: $(OBJS_LIST)
   create exe here
 
$(OBJS_LIST): $(SRC_NAMES)
    compile and generate object file for each source files here.
 
#############################################

This is not working. Since OBJS_LIST contains many object names, compilation action is repeated for many times for the target $(OBJS_LIST). My question is how to split the obj target into multiple targets without hard-coding the target obj names?

Thanks,
Anand

Last edited by Anand Venkatesa; 08-16-2013 at 03:46 AM.. Reason: Trivial Change in Title
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Creating new system Makefile template

I am attempting to set-up a Makefile to use for a new system on a Sun Unix machine. I am new to creating Makefiles. I am trying to start simply by compiling a program. I am getting the following error message but an uncertain what 'Error Code 1' is. Is there a web site with Error Codes... (1 Reply)
Discussion started by: CaptainRo
1 Replies

2. UNIX for Dummies Questions & Answers

Makefile question

I'm trying to do string replacement with a Makefile and this is my scenario: Inside file "fileA", I have "#include<text>" statements and I want to replace it with the text inside a file called "params". I wish to perform this task using Makefiles. I've tried using m4 but that only works if... (1 Reply)
Discussion started by: hc29
1 Replies

3. Programming

Tough makefile question

At my company, we build some stuff using a makefile. While the makefile script is running, a developer may check in a newer version of a source file. The problem is, when we next run the make command, the target file isn't rebuilt, because the date of the target is after the dependency. Any... (1 Reply)
Discussion started by: mbbeaubi
1 Replies

4. UNIX for Dummies Questions & Answers

makefile Q about targets $@

Hi All I need to parse the target something like: ifeq '$@' 'first' echo 1 $@ endif ifeq '$@' 'second' echo 2 $@ endif The thing is to be able compare the target string to any string and then do the commands Thanks a lot ziv (0 Replies)
Discussion started by: zivsegal
0 Replies

5. Shell Programming and Scripting

Makefile question

Hi all, I've a makefile which has this line: @touch $@ I know $@ is for representing the target. But I don't know what's the @ preceding the touch. Can anyone help me? Thanks in advance. (4 Replies)
Discussion started by: mjdousti
4 Replies

6. UNIX for Dummies Questions & Answers

makefile Question

Hello, I'm trying to use the make command with a makefile I've made for an assignment. The professor supplied the code and I've copied it into a new file. I made sure to place the tabs in the correct spaces, however when I try to execute it in UNIX I get: "make: Fatal error in reader:... (5 Replies)
Discussion started by: Shinra1003
5 Replies

7. AIX

makefile question

Hi all, In a makefile I would like to grab the first line of a given parameter file using ‘head' and assign it to a variable, how do I do this? I've got a simple makefile but it does not work? #! /bin/ksh ... .sqc.c: db2prep $*.sqc bindfile if ] DB2_PARM=`/usr/bin/head -1 $*.prm`; fi... (2 Replies)
Discussion started by: apersak
2 Replies

8. UNIX for Advanced & Expert Users

Help in creating a makefile

Hi, I wanted to know whether there is any way to specify in a makefile how to compile sources from a directory directly by giving the directory path name instead of mentioning each and every source file name. Regards, Anil (1 Reply)
Discussion started by: anil_lami
1 Replies

9. UNIX for Advanced & Expert Users

makefile head-scratcher: multiple targets in one go

Hi! I've got a build process where scripts create multiple targets from their sources. But here I'm running into a conceptual problem of GNU make: If one has multiple targets in a dependency, make applies the rules once for every target that is out of sync - which is correct for normal... (3 Replies)
Discussion started by: treczoks
3 Replies

10. Programming

Problem creating a makefile

hello, I'm trying to create a makefile to run multiple c files. I am able to run one c file only with the code I have when I tried to run 2 or more c files I'm not able. here is my code # $Source: /home/hectormasencio/make/Makefile,v $ # $Date: 2012/11/27 11:35:30 $ CC= gcc OBJS= temp.o... (3 Replies)
Discussion started by: Hector M.
3 Replies
PERLCE(1)						 Perl Programmers Reference Guide						 PERLCE(1)

Name
       Perl for WinCE

Description
       This file gives the instructions for building Perl5.6 and above for WinCE.  Please read and understand the terms under which this software
       is distributed.

Build
       This section describes the steps to be performed to build PerlCE.

       Tools & SDK

       For compiling, you need Microsoft Embedded Visual Tools, my celib-sources, my console-sources and a perl for win32.

       Needed source files can be downloaded via: www.rainer-keuchel.de/wince/dirlist.html

       Some portions of the makefile need a shell for win32, rm, cp, mv, xmkdir (mkdir with a -p option).  It also uses my cecopy program for
       copying files to the ce device.

       Make

       Miniperl is not built. A pre-existent win32 perl is used.

       The paths for tools and additional libraries have to be changed in wince/makefile.ce.

       Different ce targets can be specified with the TARGET macro.

       Before you start, you need to build celib.dll and w32console.  See instructions in these packages for building.

       In the wince directory, type "nmake -f makefile.ce". This should build perl.exe and perl.dll. For building extension dlls, type "nmake -f
       makefile.ce dlls"

       When building ext dlls, you get lots of macro redefinition errors. Just ignore them.

       For further information, look in the text files in the wince sub-directory.

Acknowledgements
       The port for Win32 was used as a reference.

Author
       Rainer Keuchel (keuchel@netwave.de)

perl v5.8.0							    2003-02-18								 PERLCE(1)
All times are GMT -4. The time now is 10:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy