shithub: tlsclient

ref: 94f2907dc40a6415a10c252cb9ba3971f1f7e838
dir: /third_party/boringssl/Makefile/

View raw version
.PHONY: all clean

include eureka.mk

CFLAGS += -Isrc/include -O2

CRYPTO_objs = $(patsubst %.c,%.o,$(filter %.c,$(crypto_sources))) $(patsubst %.cc,%.o,$(filter %.cc,$(crypto_sources)))
SSL_objs = $(patsubst %.c,%.o,$(filter %.c,$(ssl_sources))) $(patsubst %.cc,%.o,$(filter %.cc,$(ssl_sources)))

MACH := $(shell $(CC) -dumpmachine 2>/dev/null)

USE_ASM := false

ifneq (,$(findstring linux,$(MACH)))
	ifneq (,$(findstring x86_64,$(MACH)))
		CRYPTO_objs += $(crypto_sources_asm:.S=.o)
		USE_ASM := true
	endif
	ifneq (,$(findstring i686,$(MACH)))
		CRYPTO_objs += $(crypto_sources_asm:.S=.o)
		USE_ASM := true
	endif
	ifneq (,$(findstring aarch64,$(MACH)))
		CRYPTO_objs += $(crypto_sources_asm:.S=.o)
		USE_ASM := true
	endif
	ifneq (,$(findstring ppc64le,$(MACH)))
		CRYPTO_objs += $(crypto_sources_asm:.S=.o)
		USE_ASM := true
	endif
endif

ifeq (,$(findstring true,$(USE_ASM)))
	CFLAGS += -DOPENSSL_NO_ASM
endif

all: libssl.a libcrypto.a

libcrypto.a: $(CRYPTO_objs)
	ar cr libcrypto.a $(CRYPTO_objs)

libssl.a: $(SSL_objs)
	ar cr libssl.a $(SSL_objs)

.SUFFIXES: .c .o

%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

%.o: %.cc
	$(CXX) $(CFLAGS) -c -o $@ $<

%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

clean:
	rm -f $(CRYPTO_objs)
	rm -f $(SSL_objs)
	rm -f libssl.a
	rm -f libcrypto.a