Tools
How to avoid full compilation for a small change in header file in C
Sep 13th
Sometimes it is very annoying to wait for full compilation when a small and non-invasive change is made in a common header file that is included by many C files. This typically happens due to header file dependency rules. If you are sure that your change doesn’t really affect other C files expect a few, you change the time stamp of the modified header to a date in past. Also you should change the time stamp of affected C files to current. This ensures that no other files compile except the ones for which you changed the time stamp.
Identifying the More >
How to build in silent mode using GNU make
Aug 19th
Use the following command for absolutely silent build
make -s
Use the following command for absolutely silent build except printing directory before and after processing.
make -s -w
How to merge two files using text mode in Linux
May 10th
The Linux provides a command “vimdiff” which can open two files using standard “vim” editor but in two separate logical windows. This is a text-mode based tool. This tool highlights the differences between two files so that the user can inspect the differences and change or move the contents from one window to the other.
First of all, the two file which need merging have to be opened with “vimdiff” as shown below.
vimdiff file1.c file2.c
User can type “Ctrl w w” key combination to switch between windows i.e effectively between two files. You can use standard “vim” commands to copy and paste More >
How to set up a CVS server in Linux
Feb 18th
Repository Initialization
First create a directory to be used as CVS repository and initialize it as shown below.
[root@techpulp ~]# mkdir /cvsroot [root@techpulp ~]# chmod 1777 /cvsroot
Initialize the repository for the first time
[root@techpulp ~]# cvs -d /cvsroot initInstall inetd or xinetd
The CVS server requires either legacy “inetd” or latest “xinetd” package be installed in the system. If you don’t know how to find it, look for the presence of “/etc/inetd.conf” file for “inetd” package and look for the presence of “/etc/xinetd.d” directory for “xinetd” package. If none of them is present, you should install “xinetd” package. You can install a More >
Concurrent Version System (CVS) Quick Guide
Feb 18th
CVS is a heavily used source control system both in open source projects and commercial projects. This article explains frequently used commands by a developer.
Set the command-line environmentFirstly, before using cvs command, the CVSROOT environment variable should be set to point to CVS server. This command can be placed in ~/.bashrc to make it as default environment.
[neo@techpulp ~]# export CVSROOT=:pserver:neo@cvs.techpulp.com:/cvsroot
In the above command, cvs.techpulp.com is the CVS server, neo is the user name on the CVS server and /cvsroot is the base of the CVS repository in the server.
It is not necessary that CVS must be used only with remote CVS server. If you More >
WebDAV – Resolve – (405 Method Not Allowed) in response to PROPFIND request for ‘/svn’
Jan 14th
While configuring WebDAV with Apache for accessing SVN repository using web service, if there is a small misconfiguration related to “Location” directive you will see the following error:
svn: Server sent unexpected return value (405 Method Not Allowed) in response to PROPFIND request for '/svn'
Most probably you would have configured a trailing “/” character along with the location as shown below which requires correction.
<Location /svn/> DAV svn SVNPath /project/svn </Location>
You should remove trailing “/” from the path “/svn/” given in the “Location” directive and the modified one looks like this.
<Location /svn> DAV svn SVNPath /project/svn </Location>
If you haven’t made the above More >
Why GNU make compiles even if there are no modified files
Dec 8th
Some times GNU Make continue to compile some files even if there are no modifications. Typically it happens if you have transferred the files from some other system whose time is set to future. As while transferring files using tarball (archive created by tar command) retains the time stamps of the files, GNU Make thinks that those files are modified and keeps compiling them all the time.
To get rid of this problem, just set time stamp of all source files to current date and time of the system. You can use “touch” command as shown below.
[neo@techpulp ~]# find . -iname More >
Why GNU Make always says `target’ is up to date
Dec 5th
The GNU make expects the rule target to be files by default. That’s why it first checks the presense of a file/directory with the name specified in the rule. For example GNU make attempts to find if a file with name “target1″ with the following Makefile.
target1: prog prog: one.o two.o gcc $^ -o prog
If by chance you have a file or directory with name “target1” in the same directory, GNU Make interprets its last modified date. Because of that some times Make doesn’t compile anything saying target is up to date even if some of the dependencies are changed.
It is More >
GNU Make – How to compile all c files in present directory
Dec 5th
The “shell” built-in function supported by GNU Make can be used to get the list of C source files in a directory. Then a list of corresponding object files can be created by replacing the file extension in the file list. The following example shows how to compile all C source files present in the current directory to generate an executable named “target“. If you are doing copy and paste of the following example, ensure that you place TAB for all commands under each rule. Otherwise GNU Make complains about “missing separator” error.
TARGET=target SRCS=$(shell ls *.c) OBJS=$(SRCS:.c=.o) all: $(TARGET) $(TARGET):$(OBJS) More >


Recent Comments