First you must download the source tarball.
Copy or move the tarball to a directory of your choosing then:
tar -xzf newprogram-1.0.tar.gz
sudo make install
newprogram generates a new C program in it's own named directory.
The generated code comprises the main C source file, optional options processing and all the autotools necessary to build and run this new program. Code generated includes accurate but most likely useless help text for the specified options. Named source file code is hard linked into the new project directory.
newprogram [options] new_pr_name
newprogram --with-options \ --options-list 'nno-optarg mmust-have-optarg: ccould-have-optarg::' \ --depends 'dirs.c+h files.h+c str.c+h firstrun.h+c' \ --extra-dist 'data-file1 data-file2 ... data-fileN' \ TestProgram
A directory named Testprogram will be created in your named program directory.
A main C program testprogam.c will be created in the new directory.
All necessary autotools files will be generated to allow the usual ./configure && make && sudo make install to be performed.
Because --with-options was invoked, the files gopt.c and gopt.h will be created also. By default --help option is provided automatically.
The --options-list options in this example:
nno-optarg - the beginning n is the short option name, the next word no-optarg is the long option name and the absence of any : suffix means that there is no options argument.
mmust-have-optarg: - m is the short name and must-have-optarg: the long name. The suffix : means that an options argument must be provided if the option is selected.
ccould-have-optarg:: - naming (c and could-have-optarg) is the same as above. The :: suffix generates code that supports that the user may optionally provide an option argument.
The example above invokes the --options-list option with a quote protected space separated list. It would be just as valid to invoke the option 3 times, each time with a single option specifier.
When this option is invoked the --with-options invocation is redundant but harmless.
The --depends option is followed by a quote protected space separated list of software names. The names in this example all have 'c+h' on the end. In processing eg dirs.c+h will be expanded to dirs.c and dirs.h.
This expanded software list will be entered as dependency names in the completed Makefile.am.
Also, two named directories will searched for this software list, a boilerplate dir and a components dir. Items found in the boilerplate dir will be copied into the new project dir and those found in the components dir will be hardlinked there.
You can enter software names that do not yet exist in the searched dirs and warning messages will be issued for any such items.
The option may be invoked any number of times on single software items or on shorter lists.
The --extra-dist option may be invoked many times on single items or, as in the example a quote protected space separated list of filenames. These files will when sudo make install is run will be installed in /usr/local/share/testprogram/.
An empty man page, in this example, testprogram.1 is generated and when sudo make install is run, it will be installed in /usr/local/share/man/man1/. It is also automatically inserted in the extra-dist list so that sudo make distcheck will not fail.
Consequently a redundant copy of testprogram.1 is also placed in /usr/local/share/testprogram/. Nothing's perfect!
Go to the top of the page