What you need then is a software automation system . There are several ways this can be done, but I have never dealt with any of them seriously, hehe!
This is a really vast subject - just the Wikipedia page on software automation systems () is already a very big one. As you might expect, each one has its pros and cons.
But to shorten your search, I'd give you two recommendations: waf and cmake . They are versatile and easy to learn, and the major distributions and software installation channels are well supported. Waf I would recommend for small projects, and Cmake for the larger ones. ( GNU Autotools are famous and widely used, but I find them too complicated.)
After that, well, you can already open an account at Github , Gitlab , Sourceforge , Bitbucket or whatever, and Release your software to the world! (Here's the time you'll think of license to choose ...).
Q.: As for apt-get
, this is specifically a package installation command. Each distribution handles this in its own way. Because of this, I would recommend leaving this package creation to the developers of each distro.