{"id":26776908,"url":"https://github.com/chiragobhan/cpu-scheduling-using-makefile","last_synced_at":"2025-07-12T13:33:25.728Z","repository":{"id":216042130,"uuid":"264011733","full_name":"chiragobhan/cpu-scheduling-using-makefile","owner":"chiragobhan","description":"An Introduction to \"make\" with installation guide and an example of CPU Scheduling in C using Makefile.","archived":false,"fork":false,"pushed_at":"2020-05-14T22:08:29.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T04:37:33.257Z","etag":null,"topics":["c","cpu-scheduling","fcfs","first-come-first-serve","gcc","input-output","makefile","shortest-job-first","sjf"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chiragobhan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-14T19:54:55.000Z","updated_at":"2021-07-03T08:55:26.000Z","dependencies_parsed_at":"2024-01-08T07:00:18.096Z","dependency_job_id":null,"html_url":"https://github.com/chiragobhan/cpu-scheduling-using-makefile","commit_stats":null,"previous_names":["chiragobhan/cpu-scheduling-using-makefile"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chiragobhan/cpu-scheduling-using-makefile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiragobhan%2Fcpu-scheduling-using-makefile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiragobhan%2Fcpu-scheduling-using-makefile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiragobhan%2Fcpu-scheduling-using-makefile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiragobhan%2Fcpu-scheduling-using-makefile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chiragobhan","download_url":"https://codeload.github.com/chiragobhan/cpu-scheduling-using-makefile/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiragobhan%2Fcpu-scheduling-using-makefile/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265002214,"owners_count":23696075,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpu-scheduling","fcfs","first-come-first-serve","gcc","input-output","makefile","shortest-job-first","sjf"],"created_at":"2025-03-29T04:37:11.693Z","updated_at":"2025-07-12T13:33:25.712Z","avatar_url":"https://github.com/chiragobhan.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CPU Scheduling in C using Makefile\nCompiling the source code files can be tiring, especially when you have to include several source files and type the compiling command every time you need to compile. Makefiles are the solution to simplify this task. Makefiles are special format files that help build and manage the projects automatically.\n## Run and compile your programs more efficiently with this handy automation tool.  \n  \nIf you want to run or update a task when certain files are updated, the `make` utility can come in handy. The `make` utility requires a file, `Makefile` (or `makefile`), which defines set of tasks to be executed. You may have used `make` to compile a program from source code. Most open source projects use `make` to compile a final executable binary, which can then be installed using `make install`.\n  \n## Install Make\n### Linux\nSimply run the following command on your terminal:  \n`sudo apt-get install build-essential`  \n### Windows  \n`make` is a GNU command so the only way you can get it on Windows is installing a Windows version like the one provided by [GNUWin32](http://gnuwin32.sourceforge.net/packages/make.htm). Or you can install [MinGW](http://www.mingw.org/) and then do:  \n`copy c:\\MinGW\\bin\\mingw32-make.exe c:\\MinGW\\bin\\make.exe`  \nOther option is using [Chocolatey](https://chocolatey.org/install). First you need to install this package manager. Once installed you simply need to install `make`:  \n`choco install make`  \n\n## Explaination\nTo further understand `make`, I will be using my previous CPU Scheduling example with some modifications (mentioned below). Link - https://github.com/chiragobhan/cpu-scheduling  \nLet us understand our source code files of this repo:  \n1. init.h (This is the initailization header file which will open \"input.txt\" to scan the value of processes)  \n2. fcfs.h (This header file includes the logical block of FCFS which is seperated from main program)  \n3. sjf.h (This header file includes the logical block of SJF which is seperated from main program)  \n4. program.c (All the header codes are included in this program and their respective functions are being called)  \n  \nNow the trivial way to compile the files and obtain an executable, is by running the command −  \n`gcc  program.c -o program`  \nThe above command generates \"program.exe\" which can be executed directly. In this example we have only four files and we know the sequence of the function calls. Hence, it is feasible to type the above command and prepare a final binary.  \nHowever, for a large project where we have thousands of source code files, it becomes difficult to maintain the binary builds.\n  \nThe make command allows you to manage large programs or groups of programs. As you begin to write large programs, you notice that re-compiling large programs takes longer time than re-compiling short programs. Moreover, you notice that you usually only work on a small section of the program ( such as a single function ), and much of the remaining program is unchanged.\n\n## Executing Make\nRun the following command in your terminal:  \n`make`  \nIf the command is successfull, you will get a similar output:\n  \n![make output](https://user-images.githubusercontent.com/32812640/81988304-d9960f00-9658-11ea-910b-ab9e45f3c6c1.PNG)  \nAlso observe, 2 new files are created in your directory.  \n1. program.o (An object file which will be used to create the executable file)  \n2. program.exe (Executable file which executes program.c)  \n  \nThe further steps of executing program.exe is similar to the previous CPU Scheduling example which can be referred here - https://github.com/chiragobhan/cpu-scheduling\n\n## References\n1. https://opensource.com/article/18/8/what-how-makefile  \n2. https://www.tutorialspoint.com/makefile/why_makefile.htm  \n3. https://stackoverflow.com/questions/32127524/how-to-install-and-use-make-in-windows\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiragobhan%2Fcpu-scheduling-using-makefile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchiragobhan%2Fcpu-scheduling-using-makefile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiragobhan%2Fcpu-scheduling-using-makefile/lists"}