| Previous (Step 1) | Next (Step 3) |
If we want rpcgen to generate everything, we can just run:
This will create the client (add_client.c), the server (add_server.c), and the makefile (makefile.add or Makefile.add, depending on whether you are using SunOS or Linux; OS X will not create a makefile).rpcgen -a -C add.x
If you want to generate only the client template code, run:
If you want to generate only the server function template code, run:rpcgen -Sc -C add.x >add_client.c
If you want to generate only the makefile, run:rpcgen -Ss -C add.x >add_server.c
rpcgen -Sm -C add.x >makefile.add
Note that the previous command will not work on OS X. The -Sm option is not supported.
Now we can compile our code by running:
To cut down on typing, let us rename makefile.add to makefile. This will allow us to simply type make with no parameters to recompile since by default make looks for a file named makefile or Makefile.make -f makefile.add (or Makefile.add)
If you need to change the name of the compiler to gcc because the default, cc, is not present on your system, you'll need to add a line to the makefile (for example, before the CFLAGS= line):mv makefile.add makefile
CC=gcc
If you're using OS X, you'll have to compile the files individually (see step 3) until you write a makefile.
| Previous (Step 1) | Next (Step 3) |