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, 29.03.2010, 01:23

Thanks for all suggestions. After some thinking it seems that
gcc -dumpmachine
is the best choice for me. So I added following into my makefile:

CCSYSTEM = $(shell $(CC) -dumpmachine)
to get current compiler platform (path is set) and then decide target filename:

# Files
PROGNAME = SPIPGM
ifeq ($(findstring mingw32, $(CCSYSTEM)), mingw32)
PROGNAME = SPIPGMW
endif
ifeq ($(findstring cygwin, $(CCSYSTEM)), cygwin)
PROGNAME = SPIPGMW
endif
PROGEXT = EXE
ifeq ($(findstring linux, $(CCSYSTEM)), linux)
PROGEXT =
endif


BTW I wonder if make is too silly that don't know logical operators to be able to write
ifeq ($(findstring mingw32, $(CCSYSTEM)), mingw32) || ($(findstring cygwin, $(CCSYSTEM)), cygwin)
or even simpler if multiple substring search possible
infeq ($(findstring mingw32 cygwin ..., $(CCSYSTEM)), )
condition in one line but probably I missed that - not a make guru ;)

---
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, 177 users online (0 registered, 177 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum