Question

I'm writing a compiler and there are certain things that I simply can't do without knowing where the user will have my compiler and its libraries installed such as including and referencing libraries that add built-in functionality like std I/O. Since this is my first venture into compilers I feel that it's appropriate to only target Linux distributions for the time being.

I notice that a lot of compilers (and software projects in general) include makefiles or perhaps an install.py file that move parts of the application across the user's file system and will ultimately leave the user with something like a new shell command to run the program, which, (in a compiler such as python's case) knows where the necessary libraries are and where the other necessary files have been placed in order to run the program properly.

How does this work? Is there some sort of guideline to follow when designing these install files?

Was it helpful?

Solution

I think the best guideline I can give you at a high level would be:

Don't do this yourself. Just don't.

Use something like the autotools or any of the dozen or so other build systems out there that handle much of the details involved here for you.

That being said they also add a certain amount of complexity when you are just starting out and that may or may not be worth the effort to start with but they will all pay off in the end assuming you use them appropriately and don't need anything too extensively specialized that they don't provide nicely.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top