1*da0073e9SAndroid Build Coastguard Workerload("@rules_cc//cc:defs.bzl", "cc_library") 2*da0073e9SAndroid Build Coastguard Worker 3*da0073e9SAndroid Build Coastguard Worker# This macro provides for generating both "sleef<foo>" and 4*da0073e9SAndroid Build Coastguard Worker# "sleefdet<foo>" libraries for a given set of code. The difference is 5*da0073e9SAndroid Build Coastguard Worker# that the "det" libraries get compiled with "-DDETERMINISTIC=1". 6*da0073e9SAndroid Build Coastguard Worker 7*da0073e9SAndroid Build Coastguard Workerdef sleef_cc_library(name, copts, **kwargs): 8*da0073e9SAndroid Build Coastguard Worker cc_library( 9*da0073e9SAndroid Build Coastguard Worker name = name, 10*da0073e9SAndroid Build Coastguard Worker copts = copts, 11*da0073e9SAndroid Build Coastguard Worker **kwargs 12*da0073e9SAndroid Build Coastguard Worker ) 13*da0073e9SAndroid Build Coastguard Worker 14*da0073e9SAndroid Build Coastguard Worker prefix = "sleef" 15*da0073e9SAndroid Build Coastguard Worker if not name.startswith(prefix): 16*da0073e9SAndroid Build Coastguard Worker fail("name {} does not start with {}".format(repr(name), repr(prefix))) 17*da0073e9SAndroid Build Coastguard Worker 18*da0073e9SAndroid Build Coastguard Worker cc_library( 19*da0073e9SAndroid Build Coastguard Worker name = name.replace(prefix, prefix + "det", 1), 20*da0073e9SAndroid Build Coastguard Worker copts = copts + ["-DDETERMINISTIC=1"], 21*da0073e9SAndroid Build Coastguard Worker **kwargs 22*da0073e9SAndroid Build Coastguard Worker ) 23