Compiling Generated C Code : Details of Compilation and Linking : Adding Files to the Prototype

Adding Files to the Prototype

The following is an example of the User_Makefile on UNIX.

CC = acc

OBJECTS = user_activities_out.o

CFLAGS = -o -I$$STM_ROOT/etc/prt/c\
-I$$STM_ROOT/etc/sched -DPRT

all : out_lib.a

out_lib.a : $(objects)

ar rvu out_lib.a $(objects)
ranlib out_lib.a

Assume that you wish to add a file myfile.c and a header myfile.h to the prototype. The User_Makefile should look like:

CC = acc

OBJECTS = user_activities_out.o myfile.o

CFLAGS = -o -I$$STM_ROOT/etc/prt/c\
-I$$STM_ROOT/etc/sched -DPRT

all : out_lib.a

out_lib.a : $(objects)

ar rvu out_lib.a $(objects)
ranlib out_lib.a

myfile.o : myfile.h

 

The following is an example of the User_Makefile on a PC.

CC = cl

OBJECTS = user_activities.obj

 

CFLAGS = /nologo /MTd /W3 /Zd /Os

/I “$(STM_ROOT)\etc\prt\c”

/I “$(STM_ROOT)\etc\sched”

/D “PRT”

/D “LIB4WIN_NT”

 

all : tmp_out_lib.lib

tmp_out_lib.lib : $(OBJECTS)

lib $(OBJECTS) /OUT:tmp_out_lib.lib

 

user_activities.obj : user_activities.h\

garage_c_profmain.h\

garage_door.h