As pludi said, makefiles are great for this kind of job.
What you have is: to to create something, this otherthing must be done before.
A common place on source compilation is:
I need to build the executable, but first I need to build each individual object. Than I link all objects to produce an executable.
The beauty on Makefiles is that it "knowns" your source file has changed and build only that single file you need.
You can now run:
if you update file2.c, make sees it's timestamp is newer than corresponding file2.o and recompiles it, then relinks it into your executable.
To cleanup all objects:
And so on...
Nice, uh?
PS: That makefile was not tested, probably have some problems.
Hi All,
I need a script to compile multiple *.pli source files.
I can take care of the compile part, it's getting the list of files into an array or parsable string that I'm having the difficult with.
ls or find come to mind, but I can only redirect those to a file. I need to use the file... (2 Replies)
so i have hundreds of files named history.20071112.tar
(history.YYYYMMDD.tar)
and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis
here is what i have so far:
for FILE in `cat dirlist`
do
tar xvf $FILE ./status_*
done
dirlist is a text... (4 Replies)
Hi, I'm new here an dlearning a lot from this forum. i didnt find any solution for this in the forum.
I have already checked in folders in subversion named
HTT01,... HTT21.. and have files in each folder like below:
HTT01/HTT01_00000.hex
HTT01/HTT01_00000_fb_result.hex... (2 Replies)
I have a directory full of zip files.
How would I write a bash script to enumerate all the zip files, remove the ".zip" from the file name, create a directory by that name and unzip each zip file into its corresponding directory?
Thanks!
Siegfried (3 Replies)
I have a file (email) containing email addresses.
I have a second file (terms) that contains simple regular expressions and words/characters. Here are some examples:
\.trainee
\.group
\.web
I want to go through email and delete lines containing the expressions/words from terms and write... (1 Reply)
Hi, I have a bunch of media files in a directory that have been converted (from MTS to MOV format), so my directory contains something like this:
clip1.mts
clip1.mov
clip2.mts
clip2.mov
The problem is that the .mov files that have been created have the timestamps of the conversion task,... (2 Replies)
I have 2 files generated in linux that has common output and were produced across multiple hosts with the same setup/configs. These files do some simple reporting on resource allocation and user sessions. So, essentially, say, 10 hosts, with the same (2) system reporting in the files, so a... (0 Replies)
Hi,
I'm using awk command in bash script. I'm able to pass multiple files to awk for processing.The code i can use is as below(sample code)
#!/bin/bash
awk -F "," 'BEGIN {
...
...
...
}' file1 file2 file3
In the above code i'm passing the file names manually and it is fine till my... (7 Replies)
Hi Everybody,
I'm a newbie to shell scripting, and I'd appreciate some help. I have a bunch of .txt files that have some unwanted content. I want to remove lines 1-3 and 1028-1098.
#!/bin/bash
for '*.txt' in <path to folder>
do
sed '1,3 d' "$f";
sed '1028,1098 d' "$f";
done
I... (2 Replies)
Hello UNIX & Linux Forums community! Long time Linux daily user hobbyist, new to shell scripting....
I'm working on a script that does all the "work" in one script, and makes calls to a second script to display info to the user via mostly expanding variables in heredocs.
I'm contemplating... (6 Replies)
Discussion started by: Cody Learner
6 Replies
LEARN ABOUT SUSE
gccmakedep
gccmakedep(1) General Commands Manual gccmakedep(1)NAME
gccmakedep - create dependencies in makefiles using 'gcc -M'
SYNOPSIS
gccmakedep [ -sseparator ] [ -fmakefile ] [ -a ] [ -- options -- ] sourcefile ...
DESCRIPTION
The gccmakedep program calls 'gcc -M' to output makefile rules describing the dependencies of each sourcefile, so that make(1) knows which
object files must be recompiled when a dependency has changed.
By default, gccmakedep places its output in the file named makefile if it exists, otherwise Makefile. An alternate makefile may be speci-
fied with the -f option. It first searches the makefile for a line beginning with
# DO NOT DELETE
or one provided with the -s option, as a delimiter for the dependency output. If it finds it, it will delete everything following this up
to the end of the makefile and put the output after this line. If it doesn't find it, the program will append the string to the makefile
and place the output after that.
EXAMPLE
Normally, gccmakedep will be used in a makefile target so that typing 'make depend' will bring the dependencies up to date for the make-
file. For example,
SRCS = file1.c file2.c ...
CFLAGS = -O -DHACK -I../foobar -xyz
depend:
gccmakedep -- $(CFLAGS) -- $(SRCS)
OPTIONS
The program will ignore any option that it does not understand, so you may use the same arguments that you would for gcc(1), including -D
and -U options to define and undefine symbols and -I to set the include path.
-a Append the dependencies to the file instead of replacing existing dependencies.
-fmakefile
Filename. This allows you to specify an alternate makefile in which gccmakedep can place its output. Specifying "-" as the file
name (that is, -f-) sends the output to standard output instead of modifying an existing file.
-sstring
Starting string delimiter. This option permits you to specify a different string for gccmakedep to look for in the makefile. The
default is "# DO NOT DELETE".
-- options --
If gccmakedep encounters a double hyphen (--) in the argument list, then any unrecognized arguments following it will be silently
ignored. A second double hyphen terminates this special treatment. In this way, gccmakedep can be made to safely ignore esoteric
compiler arguments that might normally be found in a CFLAGS make macro (see the EXAMPLE section above). -D, -I, and -U options
appearing between the pair of double hyphens are still processed normally.
SEE ALSO gcc(1), make(1), makedepend(1).
AUTHOR
The version of the gccmakedep included in this X.Org Foundation release was originally written by the XFree86 Project based on code sup-
plied by Hongjiu Lu.
Colin Watson wrote this manual page, originally for the Debian Project, based partly on the manual page for makedepend(1).
X Version 11 gccmakedep 1.0.2 gccmakedep(1)