The next example shows a makefile that compiles a program that uses the curses and termlib library packages for screen-oriented cursor motion.
Table 4-10 Makefile for a C Program with System-Supplied Libraries
Because the link editor resolves undefined symbols as they are encountered, it is normally a good idea to place library references at the end of the list of files to link.
This makefile produces:
$ make cc -O -c main.c cc -O -c data.c cc -O -o functions main.o data.o -lcurses -ltermlib