A C program to initiate another C program.

in #programming7 years ago

I'm retired from work but I try to keep the mind ticking over by writing programs in C.

newprogram

A C program to initiate a new C programming project.

What it will do for you

  1. It will create a new named project directory within your designated
    programs directory.
  2. It will generate your Makefile.am within your new project directory.
  3. Optionally provide a list of software dependencies within the
    Makefile.am and hardlink those software files into your project
    directory if they reside within a named software source library or copy
    boilerplate files into the project directory if they reside in a named
    Stubs directory.
  4. Optionally name files for extra distribution within the
    Makefile.am.
  5. Automatically provide the code in Makefile.am to name the project
    manpage.

Naming conventions

The names within the project are determined by the name you use when you
run the program.
For example

newprogram [option] SomeThing
  1. Source directory will be: Something
  2. The binary will be: something
  3. Source code will be: something.c
  4. And the manpage: something.1

No matter what case you use for the target name, the case of the
resulting objects will be as shown above.

The program generated it's own Makefile.am

Invocation

newprogram --depends 'dirs.c+h files.c+h str.c+h firstrun.c+h' -o -x
'paths.cfg am.mak' Newprogram

The Makefile.am that was made

#generated by newprogram

#AM_CFLAGS=-Wall -Wextra -O2 -D_GNU_SOURCE=1
# Set up initially to use GDB, change to optimised afterward.
AM_CFLAGS=-Wall -Wextra -g -O0 -D_GNU_SOURCE=1

bin_PROGRAMS=newprogram

newprogram_SOURCES=newprogram.c dirs.c dirs.h files.c files.h str.c \
str.h firstrun.c firstrun.h gopt.h gopt.c

man_MANS=newprogram.1

# next lines to be hand edited
# send <whatever> to $(prefix)/share/
newdir=$(datadir)/newprogram
new_DATA=paths.cfg am.mak
# Ensure that newprogram.1 and any other config files get put in the
# tarball. Also stops `make distcheck` bringing an error.
EXTRA_DIST=newprogram.1 paths.cfg am.mak

This file is as generated by newprogram except that I inserted the
line break at newprogram_SOURCES.

What you must do.

After you have built and installed the program you will need to have, or
create a directory where program files reside. In addition to that you
will need to have or make two directories under the
Programs directory. In my setup I have them as
Srclib/Stubs and Srclib/Components. Stubs is used for boilerplate
code that is to be copied into the project dir. The
Components sub dir is to hold working library software in source code
form.

On first run of newprogram configuration files will be copied in to
$HOME/.config/newprogram/ and you will be invited to edit those files
so as to name your own directory structure.

Your source code library and boilerplate source

The files gopt.c and gopt.h are candidates to copy into the
boilerplate sub dir, because on re-using them they must be individually
edited to fit the requirements of the program under construction. The
other header and C files may or may not be useful for your needs. If
they are they can be linked into the Components sub dir along with
whatever other library source software is in your possession.

You can get the source code from: http://github.com/rlp1938/newprogram.git

Sort:  

Congratulations @rlp1938! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You got a First Reply
You published your First Post

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @rlp1938! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @rlp1938! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.24
TRX 0.26
JST 0.041
BTC 97628.25
ETH 3466.00
USDT 1.00
SBD 3.37