Building Applications

The CCP module includes the necessary Make macros to produce a generic Makefile capable of building applications for any of the supported protocols. A application makefile needs to adhere to three simple requirements:

  1. Set the make macro PROT to desired protocol.

    Cashmere: PROT=CSM

    Treadmarks: PROT=TMK

  2. After setting PROT the makefile should include /u/cashmere/ccp/apps/shared.mk. This include file will define a standard set of macros which can then be used to create the desired executable.

  3. Use the standard macros where appropriate.

By using the standard macros, the applications will automatically be built with the proper tools and parameters, and, also, the binary files for each protocol will be kept in private directories. Multiple versions of the application can thus be built simply by changing the PROT macro.

The application objects and executables will be stored in ../$(PROT)_obj and ../$(PROT)_bin, e.g. ../csm_obj and ../csm_bin.

SOR Makefile

The following is simple CCP Makefile used to build the sor application. (See /u/cashmere/ccp/apps/sor for the full source tree.)

  #
  # SOR Makefile
  #
  
  
  # Choose the desired protocol.
  PROT = CSM
  #PROT = TMK
  
  all: appl
  
  # Load in protocol-independent macros
  include /u/cashmere/ccp/apps/shared.mk
  
  #
  # SOR macros
  # 
  TARGET = $($(PROT)_APPS_BIN)/sor
  SRC = sor.c
  OBJS = $($(PROT)_APPS_OBJ)/sor.o $($(PROT)_OBJS)
  
  
  appl:  $(TARGET) $($(PROT)_TARGETS)
  
  
  $(TARGET): $($(PROT)_APPS_OBJ)/sor.o   \
             $($(PROT)_OBJS)             \
             $($(PROT)_LIB_PATH)/lib$($(PROT)_LIB).a
  	$(LD) $(OBJS) -o $(TARGET) $(LDFLAGS)
  
  $($(PROT)_APPS_OBJ)/sor.o: sor.c $(SHARED_INC)/ccp.h
  	$(CC) -c $(CCFLAGS) -o $@ sor.c
  
  clean:
  	rm -f $(TARGET) *.S $($(PROT)_APPS_OBJ)/*.o *.s *~
  
  

[TOC]