LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 04-23-2008, 12:07 PM   #1
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, 05:33 AM   #2
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,571

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
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.
Old 07-23-2008, 02:16 AM   #3
LQ Newbie
Registered: Apr 2008
Posts: 5

Original Poster
Rep: Reputation: 0

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.
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
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

OBJS=a.o \
CC = gcc

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

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

#include "d3.h"



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 06:31 AM
command in solaris which is equivalent to "smbstatus" of linux Nupur Singh Solaris / OpenSolaris 2 02-02-2006 01:25 PM
nohup -p in solaris and equivalent in linux prakash_k Linux - General 4 01-09-2006 12:21 AM
Solaris volcheck equivalent in Linux Dopey Linux - Newbie 1 04-13-2005 05:47 AM
Is there an equivalent of core [in solaris] in linux vsg123 Linux - Software 1 07-21-2003 10:55 AM

All times are GMT -5. The time now is 03:54 AM.

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