Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Multiplatform makefile for gcc (Developers)

posted by RayeR Homepage, CZ, 26.03.2010, 01:14

Could someone give me an idea how to detect OS from makefile? I have some sources that I'm compiling with DJGPP, MinGW32 and Linux gcc. I need to link it with some OS specific libraries so I need to detect OS and use proper -l arguments and then just type "make" without different options. In C source I can simply use e.g. #ifdef __WIN32__ but make probably doesn't have something similar. It would need to call some other utility for OS detection but how this utility will run under all OSes? I can also got rough guess by testing specific environment variables e.g. "WINDIR". Or maybe grepping output of "gcc -v" (I have set proper path to compiler). But maybe it's bad idea and I should rather make 3 scripts maked, makew, makel which will call make with some args...

---
DOS gives me freedom to unlimited HW access.

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 257 users online (0 registered, 257 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum