Search notes:

Detect operating system (Windows vs Linux) with a Makefile

The following Makefile uses $(OS) to determine the OS and uses ifeq to either assign a.exe (Windows) or a.out (Linux) to a variable that stores the name of the executable.
ifeq ($(OS), Windows_NT)
	EXECUTABLE=a.exe
else
	EXECUTABLE=a.out
endif


$(EXECUTABLE): prog.c
	gcc prog.c
Github repository about-Makefile, path: /detect-os/Makefile
For completness' sake, here's a minimal c program, too:
int main() {
    return 42;
}
Github repository about-Makefile, path: /detect-os/prog.c

See also

make

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1743446337, '18.191.21.248', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/make/detect-os(58): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78