LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-23-2008, 11:07 AM   #1
sa20358
LQ Newbie
 
Registered: Apr 2008
Posts: 5

Rep: Reputation: 0
SOLARIS .KEEP_STATE equivalent command for LINUX to use in makefile


ON Linux cc files do not get recompiled if the header file it depends on is changed or the file itself is changed.
This works on SOLARIS because .KEEP_STATE target is defined in Makefile. Sravanthi needs to research this type of option in Linux - has something to do with dependancies
 
Old 04-27-2008, 04:33 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,490

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Have a look at makedepend.

Alternatively, I think (but I'm not 100% sure) you can install Sun make on Linux with Sun Studio for Linux.

http://developers.sun.com/sunstudio/index.jsp
 
Old 07-23-2008, 01:16 AM   #3
sa20358
LQ Newbie
 
Registered: Apr 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Lightbulb

Quote:
Originally Posted by jlliagre View Post
Have a look at makedepend.

Alternatively, I think (but I'm not 100% sure) you can install Sun make on Linux with Sun Studio for Linux.

http://developers.sun.com/sunstudio/index.jsp
Thanks for your reply. Now my cc files recompiles automatically after changes. I used gcc dependancy flags to create dependacy files. Below is the sample cc file and make file which works.

Folder structure with 2 c files, 2 header files, makefile and rh3 folder to create .d files in folder.

ia32-cross: pwd
/home/0358/makedepend
ia32-cross: ls
a.c b.c d1.h d2.h d3.h Makefile.subdirs_fix rh3

My Makefile:
===========
ia32-cross: cat Makefile.subdirs_fix

obj=rh3/
OBJS=a.o \
b.o
OBJECTS=$(OBJS:%=$(obj)%)
CC = gcc
CFLAGS =

all: $(OBJECTS)

$(obj)%.o: %.c
#generate the *.d file with the dependency targets.
$(CC) -MM -MP -MT $@ $< > $(subst .o,.d,$@)
$(CC) $(CFLAGS) -c $*.c -fPIC -o $@

#include the dependency files [Note no tab before "-"]
-include $(OBJECTS:.o=.d)

C and header files:
==================
ia32-cross: cat a.c

#include "d1.h"
#include "d2.h"

int main(){
printf("hello world\n");
}

ia32-cross: cat b.c

#include "d1.h"

int f(){
printf("f() called\n");
return 0;
}

ia32-cross: cat d1.h

#ifndef _D1_H
#define DEP1 1
#endif

ia32-cross: cat d2.h
#ifndef _D2_H
#define DEP2 2

#include "d3.h"

#endif
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Solaris question for watch command equivalent kinetik Linux - General 4 01-29-2010 05:31 AM
command in solaris which is equivalent to "smbstatus" of linux Nupur Singh Solaris / OpenSolaris 2 02-02-2006 12:25 PM
nohup -p in solaris and equivalent in linux prakash_k Linux - General 4 01-08-2006 11:21 PM
Solaris volcheck equivalent in Linux Dopey Linux - Newbie 1 04-13-2005 04:47 AM
Is there an equivalent of core [in solaris] in linux vsg123 Linux - Software 1 07-21-2003 09:55 AM


All times are GMT -5. The time now is 01:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration