Merge pull request #382 from ararslan/aa/freebsd
Make the build logic more robust for BSD systems (cherry picked from commit 5ab8dcf04d13494c17e503d121efc79748d5f401)
This commit is contained in:
		
							parent
							
								
									e7f4c6e47f
								
							
						
					
					
						commit
						4c2bb90dec
					
				| @ -13,9 +13,23 @@ ifndef CROSS_COMPILE | |||||||
|   CROSS_COMPILE:= |   CROSS_COMPILE:= | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| ifeq ($(CC),cc) | # We only need to go through this dance of determining the right compiler if we're using
 | ||||||
|   CC := $(CROSS_COMPILE)gcc | # cross compilation, otherwise $(CC) is fine as-is.
 | ||||||
|  | ifneq (,$(CROSS_COMPILE)) | ||||||
|  | ifeq ($(origin CC),default) | ||||||
|  | CSTR := "\#ifdef __clang__\nCLANG\n\#endif\n" | ||||||
|  | ifeq ($(PLATFORM),FreeBSD) | ||||||
|  |   # XXX: FreeBSD needs extra escaping for some reason | ||||||
|  |   CSTR := $$$(CSTR) | ||||||
| endif | endif | ||||||
|  | ifneq (,$(shell echo $(CSTR) | $(CC) -E - | grep CLANG)) | ||||||
|  |   CC := $(CROSS_COMPILE)clang | ||||||
|  | else | ||||||
|  |   CC := $(CROSS_COMPILE)gcc | ||||||
|  | endif # Clang
 | ||||||
|  | endif # cc is Make's default
 | ||||||
|  | endif # CROSS_COMPILE non-empty
 | ||||||
|  | 
 | ||||||
| LD:=$(CROSS_COMPILE)ld | LD:=$(CROSS_COMPILE)ld | ||||||
| AR:=$(CROSS_COMPILE)ar | AR:=$(CROSS_COMPILE)ar | ||||||
| 
 | 
 | ||||||
| @ -24,7 +38,12 @@ AR:=$(CROSS_COMPILE)ar | |||||||
| ARFLAGS:=r | ARFLAGS:=r | ||||||
| 
 | 
 | ||||||
| ifndef MAKE | ifndef MAKE | ||||||
|   MAKE:=make | # BSDs refer to GNU Make as gmake
 | ||||||
|  | ifneq (,$(findstring $(PLATFORM),FreeBSD OpenBSD DragonFly NetBSD)) | ||||||
|  |   MAKE=gmake | ||||||
|  | else | ||||||
|  |   MAKE=make | ||||||
|  | endif | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| ifndef INSTALL_CMD | ifndef INSTALL_CMD | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user