[Solved] COP290 Assignment1-Working with Makefiles

$25

File Name: COP290_Assignment1-Working_with_Makefiles.zip
File Size: 386.22 KB

SKU: [Solved] COP290 Assignment1-Working with Makefiles Category: Tag:
5/5 - (1 vote)

Create a Directory TopUnder this create 4 sub directories 1,2,3 4In each of these sub directories, create a small C function: An example is givenbelow:./Top/1/mySqr.cint mySquare(int x){return x*x;}./Top/2/myPythonInC.c#define PY_SSIZE_T_CLEAN#include <Python.h>int myPythonInC(int argc, char *argv[]){wchar_t *program = Py_DecodeLocale(argv[0], NULL);if (program == NULL) {fprintf(stderr, Fatal error: cannot decode argv[0]
);exit(1);}Py_SetProgramName(program); /* optional but recommended */Py_Initialize();PyRun_SimpleString(from time import time,ctime
print(Today is, ctime(time()))
);if (Py_FinalizeEx() < 0) {exit(120);}PyMem_RawFree(program);return 0;}And similarly with other programming languages or scripts in sub directories 3and 4.Write the application in the parent directory something similar to thefollowing:./Top/myApp.c#include <stdio.h>extern mySquare();extern myPythonInC();int main(int argc, char *argv[]){int a=3,b;b= mySquare(a);printf(%d
,b);myPythonInC(1,argv);}Have a makefile in each directory of this hierarchy. The Makefile in ./Top shouldrecursively call make in all the sub directories.Dos:Create object files in a subdirectory called objCreate final executable in a subdirectory called exeSet global options only in the parentHave multiple targets in your makefile (for example clean, all, RUN, only certainfunctions etc be creative J )Brownie Points:Use shell creativelyDonts:Have a single Makefile replicated in all directories.Notes:Compilation string for python embedding in C (this is machine specific)-I/usr/include/python3.6 -lpython3.6m

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COP290 Assignment1-Working with Makefiles
$25