About imake


 
Thread Tools Search this Thread
Top Forums Programming About imake
# 1  
Old 11-30-2005
About imake

Hi,
i am application developer, so for i am writing make file explictly. i come to know that using imake we can automatically write the make file for the project.........i am not developing any xwindow programs...
i thought that the imake is used write the make files only for xwindow programs....is that true or we can use imake for other programs also.
Thanks in advance
Sarwan
# 2  
Old 11-30-2005
While imake is used primarily as a helper-tool to build some X apps, imake can certainly be used for non-X things. However, given that it's distributed as part of X, it's unlikely you're going to have it available if you don't have X installed.

I find that rolling your own makefiles is usually for the best. My experiences with generators such as autotools and imake has been vexing at best -- autotools in particular is so badly supported, breaks backwards compatibility so often, and just plain breaks in so many places that it's not worth the trouble. At least a custom makefile you can rewrite yourself when it broken.
# 3  
Old 11-30-2005
To spare myself some trouble with makefiles, I generally write one like this...

Code:
# Intended for GNU make
# Prevents these targets from breaking when, say, a file named 'clean' exists
.PHONY:clean all all2

# These are used to build *.o targets
CFLAGS:=-I./include/
CXXFLAGS:=$(CFLAGS)
LDFLAGS:=-lsomething

# When you ask for a *.pic.o target, it'll use these cflags/ldflags instead of the above
LIB_CFLAGS:=$(CFLAGS) -fpic
LIB_LDFLAGS:=$(LDFLAGS) -shared

# The first target, so it gets made first, but defers to all2, which knows all targets
all:all2

# Include all makefile "modules" in the directory.
include *.makefile

# How to make objects for compilation into shared librarires
%.pic.o:%.c
        $(CC) $(LIB_CFLAGS) -c $< -o $@
%.pic.o:%.cpp
        $(CXX) $(LIB_CFLAGS) -c $< -o $@

# Cleans up all created object files and executables
clean:
        rm -f $(OBJS) $(EXETARGETS) $(LIBTARGETS)

# Build all targets
all2:$(EXETARGETS) $(LIBTARGETS)

And the makefiles that are included, look like this:
Code:
VPATH+=dir_with_code_in_it

# Describes object files for this target
# Filenames should be unique, as in, dir_with_code_in_it/foobarg_file1.c
FOOBARG_OBJS:=foobarg_file1.o foobarg_file2.o foobarg_file3.o

foobarg:$(FOOBARG_OBJS)
        $(CC) $(FOOBARG_OBJS) $(LDFLAGS) -o $@

# Add to EXETARGETS, so all2 knows about it and makes it
EXETARGETS+=foobarg

# Add to OBJS, so that clean knows what things to remove

Less pain than writing the WHOLE thing from scratch every time, less bother than using those wacky automated things.
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

mkmkfiles.imake: line 51: syntax error: unexpected end of file

Hi, i am installing glut-3.5 using that ./mkmkfiles.imake its showing an error msg as root@lxdevenv:~/Desktop/openGL/glut-3.5# ./mkmkfiles.imake ./mkmkfiles.imake: line 51: syntax error: unexpected end of file root@lxdevenv:~/Desktop/openGL/glut-3.5# actually there are 49 lines in... (3 Replies)
Discussion started by: Ravikishore
3 Replies
Login or Register to Ask a Question