ymake.core.conf 230 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756
  1. # !!! DISCLAIMER! PLEASE DON'T IGNORE !!!
  2. # The FAKEID value is huge hammer. It affects UIDs of all nodes in build graph including, but not limited to
  3. # any resource fetch (think java contrib), build on any language (C++, Python, Java, Go), any code generation.
  4. # Any build after this change will pay the price:
  5. # - Local builds and Sandbox builds will reload all resources from Sandbox and cached data from YT (if ready).
  6. # - Distributed (YT) cache warmup will take significant time to catch up and will need to recache everything.
  7. # - Autocheck will rebuild and recache everything.
  8. # Use this with extreme care and only change if it is ultimately needed. Consider more specific XXX_FAKEIDs below instead.
  9. FAKEID=628318530716
  10. SANDBOX_FAKEID=${FAKEID}.7600000
  11. CPP_FAKEID=2023-10-13
  12. GO_FAKEID=11100371
  13. ANDROID_FAKEID=2023-05-17
  14. CLANG_TIDY_FAKEID=2023-06-06
  15. CYTHON_FAKE_ID=10784829
  16. JAVA_FAKEID=108490091
  17. PROTO_FAKEID=0
  18. FBS_FAKEID=2023-09-01
  19. # Change of this value will invalidate some parts of configure cache
  20. # but will not affect builds anyhow (except tests referring build/ directory)
  21. JSON_CACHE_FAKE_ID=11215402
  22. CURDIR=.
  23. MODDIR=.
  24. BINDIR=bin:/
  25. SRCDIR=
  26. YMAKE=ymake
  27. ECHO=echo
  28. INCLUDE_EXTS=.h .hh .hpp .rli .cuh .inc .i .ipp .ixx .ya_exposed
  29. CPP_EXT=.cpp
  30. OBJ_SUF=
  31. CFLAGS=
  32. EXTRA_C_FLAGS=
  33. SFLAGS=
  34. SRCFLAGS=
  35. FORCE_COVERAGE_ENABLED=
  36. FORCE_COVERAGE_DISABLED=
  37. AUTOCHECK_BALANCING_OPTIONS=
  38. SO_OUTPUTS=no
  39. MODULE_PREFIX=
  40. MODULE_SUFFIX=
  41. @import "${CONF_ROOT}/conf/settings.conf"
  42. @import "${CONF_ROOT}/conf/opensource.conf"
  43. @import "${CONF_ROOT}/conf/sysincl.conf"
  44. @import "${CONF_ROOT}/conf/license.conf"
  45. @import "${CONF_ROOT}/conf/docs.conf"
  46. @import "${CONF_ROOT}/conf/swig.conf"
  47. @import "${CONF_ROOT}/conf/proto.conf"
  48. @import "${CONF_ROOT}/conf/fbs.conf"
  49. @import "${CONF_ROOT}/conf/project_specific/other.conf"
  50. @import "${CONF_ROOT}/conf/project_specific/yt.conf"
  51. USE_GLOBAL_CMD=no
  52. when ($OS_WINDOWS != "yes") {
  53. USE_GLOBAL_CMD=yes
  54. }
  55. when ($USE_PYTHON) {
  56. C_DEFINES+= -DUSE_PYTHON
  57. }
  58. __COMMA__=${comma:""}
  59. ARCADIA_TEST_ROOT=../arcadia_tests_data/
  60. DEFAULT_REQUIREMENTS=network:restricted cpu:1 ram:32
  61. FAIL_PY2=no
  62. _PREBUILT_TOOLS_ROOT=build/prebuilt
  63. _TOOL_PROTOC_GEN_GO=vendor/github.com/golang/protobuf/protoc-gen-go
  64. _TOOL_PROTOC_GEN_GO_V2=vendor/google.golang.org/protobuf/cmd/protoc-gen-go
  65. _TOOL_PROTOC_GEN_GO_GRPC_V2=vendor/google.golang.org/grpc/cmd/protoc-gen-go-grpc
  66. _TOOL_RESCOMPILER=tools/rescompiler
  67. _TOOL_RESCOMPRESSOR=tools/rescompressor
  68. _TOOL_RORESCOMPILER=tools/rorescompiler
  69. when ($DISABLE_SEPARATE_AUX_CPP != "yes") {
  70. SEPARATE_AUX_CPP=yes
  71. }
  72. when ($HOST_ARCH_X86_64 == "yes") {
  73. when ($HOST_OS_DARWIN == "yes" || $HOST_OS_LINUX == "yes" || $HOST_OS_WINDOWS == "yes") {
  74. VALID_HOST_PLATFORM_FOR_COMMON_PREBUILT_TOOLS=yes
  75. when ($USE_PREBUILT_TOOLS == "yes" && $ARCH_X86_64 == "yes") {
  76. _TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
  77. }
  78. }
  79. }
  80. FAIL_MODULE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${kv;hide:"p ER"} ${kv;hide:"pc red"}
  81. DEFAULT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  82. PROJECT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  83. TIDY=
  84. TIDY_ENABLED=
  85. when($TIDY == "yes") {
  86. TIDY_ENABLED=yes
  87. }
  88. when ($TIDY_ENABLED == "yes") {
  89. when ($TIDY_EXPORT_FIXES=="") {
  90. TIDY_EXPORT_FIXES="no"
  91. }
  92. CLANG_TIDY_ARGS=${hide:CLANG_TIDY_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/clang_tidy.py"} "--ymake-python" $YMAKE_PYTHON "--clang-tidy-bin" "$(CLANG_TIDY_BIN)/bin/clang-tidy" "--config-validation-script" ${input:"build/tests/config/clang_tidy/tidy_config_validation.py"} "--testing-src" ${input:SRC} "--source-root" $(SOURCE_ROOT) "--build-root" $(BUILD_ROOT) "--tidy-json" ${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJ_CROSS_SUF}.tidyjson:SRC} "--export-fixes" $TIDY_EXPORT_FIXES
  93. CLANG_TIDY_ARGS+="--default-config-file" ${input:DEFAULT_TIDY_CONFIG}
  94. CLANG_TIDY_ARGS+="--project-config-file" ${input:PROJECT_TIDY_CONFIG}
  95. when ($TIDY_CHECKS) {
  96. CLANG_TIDY_ARGS+="--checks=$TIDY_CHECKS"
  97. }
  98. when ($TIDY_HEADER_FILTER) {
  99. CLANG_TIDY_ARGS+="--header-filter=$TIDY_HEADER_FILTER"
  100. }
  101. TIDY_VALUE=USE_CONDITIONAL_SRCS
  102. }
  103. otherwise {
  104. CLANG_TIDY_ARGS=
  105. TIDY_VALUE=
  106. }
  107. # tag:profile
  108. NEED_PROFILE_RUNTIME=no
  109. when ($BUILD_TYPE == "PROFILE" || $BUILD_TYPE == "COVERAGE" || ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") || $GCOV_COVERAGE == "yes") {
  110. when($CLANG && ($TARGET_PLATFORM == "LINUX" || $TARGET_PLATFORM == "DARWIN")) {
  111. NEED_PROFILE_RUNTIME=yes
  112. }
  113. }
  114. when ($PGO_ADD == "yes") {
  115. NEED_PROFILE_RUNTIME=yes
  116. }
  117. when ($NEED_PROFILE_RUNTIME == "yes") {
  118. COPY_PROFILE_RUNTIME=\
  119. $YMAKE_PYTHON3 ${input:"build/scripts/copy_clang_profile_rt.py"} \
  120. --arch $TARGET_PLATFORM \
  121. --build-root $ARCADIA_BUILD_ROOT --
  122. COPY_PROFILE_RUNTIME+=\
  123. ${rootrel:PEERS} \
  124. $LDFLAGS
  125. }
  126. otherwise {
  127. COPY_PROFILE_RUNTIME=
  128. }
  129. # tag:codenav
  130. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  131. PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
  132. YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $CPPYNDEXER_RESOURCE_GLOBAL/yndexer 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
  133. YNDEXER_OUTPUT=${output;noauto;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.ydx.pb2:SRC}
  134. }
  135. otherwise {
  136. PY_PROGRAM_LINK_EXE=$LINK_EXE
  137. YNDEXER_ARGS=
  138. YNDEXER_OUTPUT=
  139. }
  140. when ($RETRY == "yes") {
  141. RETRY_ARGS=$YMAKE_PYTHON ${input:"build/scripts/wrapcc.py"}
  142. }
  143. otherwise {
  144. RETRY_ARGS=
  145. }
  146. COVERAGE_FLAGS=
  147. EXTRA_OUTPUT=
  148. when ($CLANG == "yes" || $GCC == "yes") {
  149. when ($BUILD_TYPE == "COVERAGE" || $GCOV_COVERAGE) {
  150. COVERAGE_FLAGS=-fprofile-arcs -ftest-coverage
  151. EXTRA_OUTPUT=${output;noauto;hide;suf=${COMPILE_OUT_SUFFIX}${_CROSS_SUFFIX}.gcno:SRC}
  152. }
  153. }
  154. when ($OS_CYGWIN == "yes") {
  155. CFLAGS+=-D_LDBL_EQ_DBL=1 -U__STRICT_ANSI__
  156. USE_ASMLIB=no
  157. FSTACK=
  158. }
  159. when ($OS_IOS == "yes" || $OS_ANDROID == "yes") {
  160. USE_ASMLIB=no
  161. }
  162. CFLAGS+=$COVERAGE_FLAGS
  163. LDFLAGS+=$COVERAGE_FLAGS
  164. CHECKFLAG=
  165. NO_MAPREDUCE=
  166. when ($NO_MAPREDUCE == "yes") {
  167. C_DEFINES+=-DNO_MAPREDUCE
  168. }
  169. when ($OS_ANDROID == "yes") {
  170. PIE=yes
  171. }
  172. when ($CLANG && $OS_DARWIN && $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  173. SO_OUTPUTS=yes
  174. }
  175. when ($OS_NONE == "yes" || $MAPSMOBI_BUILD_TARGET == "yes" && $OS_LINUX != "yes") {
  176. USE_STL_SYSTEM=yes
  177. }
  178. # USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to
  179. # select system standard C++ library when USE_INTERNAL_STL=no is set.
  180. #
  181. # USE_STL_SYSTEM=yes is a regular way to select system standard C++ library.
  182. #
  183. when ($USE_STL_SYSTEM == "yes") {
  184. USE_INTERNAL_STL=no
  185. }
  186. when ($USE_INTERNAL_STL == "no") {
  187. USE_STL_SYSTEM=yes
  188. }
  189. otherwise {
  190. USE_INTERNAL_STL=yes
  191. # TODO: Extract to conf/sysincl.conf
  192. # This trigger doesn't work for module level since SYSINCL is processed at
  193. # configuration stage (This means that NO_RUNTIME() macro called in ya.make
  194. # won't affect SYSINCL and the only way to make this trigger work correctly
  195. # is to define configuration variable NORUNTIME (-DNORUNTIME) on the command
  196. # line when `ya make ...` is invoked.
  197. when ($NORUNTIME != "yes") {
  198. SYSINCL+=build/sysincl/stl-to-libcxx.yml
  199. SYSINCL+=build/sysincl/stl-to-libcxxmsvc.yml
  200. when ($MUSL == "yes") {
  201. SYSINCL+=build/sysincl/libc-musl-libcxx.yml
  202. }
  203. }
  204. }
  205. # tag:linux-specific
  206. when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") {
  207. USE_UBUNTU_COMPATIBILITY=yes
  208. }
  209. USE_ARCADIA_PYTHON=yes
  210. USE_ARCADIA_LIBM=no
  211. USE_EAT_MY_DATA=no
  212. HAVE_MKL=
  213. when ($HAVE_MKL == "") {
  214. when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) {
  215. HAVE_MKL=yes
  216. }
  217. otherwise {
  218. HAVE_MKL=no
  219. }
  220. }
  221. SFDL_TMP_OUT= ${output;tmp:SRC.tmp}
  222. # tag:tool-specific
  223. ARCH_TOOL=${tool:"tools/archiver"}
  224. # tag:tool-specific
  225. FML_TOOL=${tool:"tools/relev_fml_codegen"}
  226. FML_UNUSED_TOOL=${tool:"tools/relev_fml_unused"}
  227. LUA_TOOL=${tool:"tools/lua"}
  228. ENUM_PARSER_TOOL=${tool:"tools/enum_parser/enum_parser"}
  229. FATAL_ERROR_MODULE=no
  230. FATAL_ERROR_MESSAGE=
  231. ANTLR_PYTHON=Python2
  232. ### @usage: NO_LTO()
  233. ###
  234. ### Disable any lto (link-time optimizations) for the module.
  235. ### This will compile module source files as usual (without LTO) but will not prevent lto-enabled
  236. ### linking of entire program if global settings say so.
  237. macro NO_LTO() {
  238. DISABLE(USE_LTO)
  239. DISABLE(USE_THINLTO)
  240. }
  241. # tag:allocator
  242. DEFAULT_ALLOCATOR=LF
  243. # tag:allocator
  244. when ($OS_ANDROID == "yes" || $MSVC == "yes" || $ARCH_TYPE_32 == "yes" || $ARCH_AARCH64 == "yes") {
  245. DEFAULT_ALLOCATOR=J
  246. }
  247. # tag:allocator
  248. when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
  249. DEFAULT_ALLOCATOR=SYSTEM
  250. }
  251. # tag:allocator
  252. when ($OS_DARWIN == "yes") {
  253. DEFAULT_ALLOCATOR=SYSTEM
  254. }
  255. # tag:allocator
  256. when ($OS_LINUX == "yes") {
  257. when ($GCC) {
  258. # tcmalloc broken build
  259. }
  260. elsewhen ($SANDBOXING) {
  261. # broken
  262. }
  263. elsewhen ($ARCH_X86_64) {
  264. DEFAULT_ALLOCATOR=TCMALLOC_TC
  265. }
  266. }
  267. # tag:allocator
  268. when ($SANITIZER_TYPE) {
  269. when ($SANITIZER_TYPE != "no") {
  270. DEFAULT_ALLOCATOR=SYSTEM
  271. }
  272. }
  273. # tag:allocator
  274. when ($ARCH_XTENSA == "yes") {
  275. DEFAULT_ALLOCATOR=FAKE
  276. }
  277. # tag:internal
  278. ### @usage: CHECK_CONFIG_H(<conf_header>) # internal
  279. ###
  280. ### This internal macro adds checking code for configuration header in external (contrib) library.
  281. ### The check is needed to avoid conflicts on certain types and functions available in arcadia.
  282. ###
  283. ### @see https://a.yandex-team.ru/arc/trunk/arcadia/build/scripts/check_config_h.py for exact details
  284. macro CHECK_CONFIG_H(Conf) {
  285. .CMD=$YMAKE_PYTHON ${input:"build/scripts/check_config_h.py"} ${input;rootrel:Conf} ${output;nopath;noext:Conf.config.cpp} ${kv;hide:"p CH"} ${kv;hide:"pc yellow"}
  286. OUTPUT_INCLUDES=$Conf
  287. }
  288. REQUIRED_TRANSITIVE_PEERS=
  289. ### @usage REQUIRES(dirs...)
  290. ###
  291. ### Specify list of dirs which this module must depend on indirectly.
  292. ###
  293. ### This macro can be used if module depends on the directories specified but they can't be listed
  294. ### as direct PEERDIR dependencies (due to public include order or link order issues).
  295. macro REQUIRES(DIRS[]) {
  296. SET_APPEND(REQUIRED_TRANSITIVE_PEERS $DIRS)
  297. }
  298. CHECK_DEPENDENT_DIRS_TYPES=
  299. CHECK_DEPENDENT_DIRS_RESTRICTIONS=
  300. ### @usage CHECK_DEPENDENT_DIRS(DENY|ALLOW_ONLY ([ALL|PEERDIRS|GLOB] dir)...)
  301. ###
  302. ### Specify project transitive dependencies constraints.
  303. ###
  304. ### @params:
  305. ### 1. DENY: current module can not depend on module from any specified directory neither directly nor transitively.
  306. ### 2. ALLOW_ONLY: current module can not depend on module from a dir not specified in the directory list neither directly nor transitively.
  307. ### 3. ALL: directory constraints following after this modifier are applied to both transitive PEERDIR dependencies and tool dependencies.
  308. ### 4. PEERDIRS: directory constraints following after this modifier are applied to transitive PEERDIR dependencies only.
  309. ### 5. GLOB: next directory constraint is an ANT glob pattern.
  310. ### 6. EXCEPT: next constraint is an exception for the rest of other rules.
  311. ###
  312. ### Directory constraints added before either ALL or PEERDIRS modifier is used are treated as ALL directory constraints.
  313. ###
  314. ### Note: Can be used multiple times on the same module all specified constraints will be checked.
  315. ### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
  316. macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RESTRICTIONS...) {
  317. SET_APPEND(CHECK_DEPENDENT_DIRS_RESTRICTIONS $PEERDIRS $RESTRICTIONS)
  318. SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
  319. }
  320. macro _RESOURCE_SEM(INPUTS[], KEYS[]) {
  321. SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
  322. .SEM=resources ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS ${tool;hide:"tools/rescompiler/bin"}
  323. }
  324. # tag:built-in
  325. ### @usage: RESOURCE([FORCE_TEXT ][Src Key]* [- Key=Value]*) # built-in
  326. ### Add data (resources, random files, strings) to the program)
  327. ### The common usage is to place Src file into binary. The Key is used to access it using library/cpp/resource or library/python/resource.
  328. ### Alternative syntax with '- Key=Value' allows placing Value string as resource data into binary and make it accessible by Key.
  329. ###
  330. ### This is a simpler but less flexible option than ARCHIVE(), because in the case of ARCHIVE(), you have to use the data explicitly,
  331. ### and in the case of RESOURCE(), the data will fall through SRCS() or SRCS(GLOBAL) to binary linking.
  332. ###
  333. ### Use the FORCE_TEXT parameter to explicitly mark all Src files as text files: they will not be parsed unless used elsewhere.
  334. ###
  335. ### @example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a2ispolzujjtekomanduresource
  336. ###
  337. ### @example:
  338. ###
  339. ### LIBRARY()
  340. ### OWNER(user1)
  341. ###
  342. ### RESOURCE(
  343. ### path/to/file1 /key/in/program/1
  344. ### path/to/file2 /key2
  345. ### )
  346. ### END()
  347. ###
  348. macro RESOURCE(Args...) {
  349. PEERDIR(library/cpp/resource)
  350. }
  351. # tag:sanitize
  352. RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
  353. # tag:sanitize
  354. when ($IS_CROSS_SANITIZE) {
  355. RUN_NO_SANITIZE=
  356. }
  357. YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args
  358. XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args
  359. WRITER_PY=$YMAKE_PYTHON ${input:"build/scripts/writer.py"} ${input;hide:"build/scripts/process_command_files.py"}
  360. FS_TOOLS=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"} ${input;hide:"build/scripts/process_command_files.py"}
  361. FIX_MSVC_OUTPUT=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ${input;hide:"build/scripts/process_command_files.py"}
  362. _PROCESS_WHOLE_ARCHIVE_SCRIPT=${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/process_whole_archive_option.py"}
  363. COPY_CMD=$FS_TOOLS copy
  364. LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy
  365. REMOVE_FILE=$FS_TOOLS remove
  366. MOVE_FILE=$FS_TOOLS rename
  367. # tag:allocator tag:windows-specific
  368. MSVC_DYNAMICBASE=/DYNAMICBASE
  369. when ($ALLOCATOR == "LF") {
  370. MSVC_DYNAMICBASE=/DYNAMICBASE:NO
  371. }
  372. # tag:sanitize
  373. SANITIZER_CFLAGS=
  374. # variables must be defined for all module types to make generate_mf.py work
  375. NEED_PLATFORM_PEERDIRS=yes
  376. PEERDIR_TEST_TOOL=yes
  377. ### @usage: _BARE_UNIT # internal
  378. ###
  379. ### The base of all modules describing default bare minimum for all modules.
  380. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  381. module _BARE_UNIT {
  382. .EXTS=.*
  383. .CMD=TOUCH_UNIT
  384. .IGNORED=GO_PROTO_PLUGIN
  385. .NODE_TYPE=Bundle
  386. .PEERDIR_POLICY=as_include
  387. .RESTRICTED=GRPC USE_SKIFF INDUCED_DEPS FUZZ_DICTS FUZZ_OPTS PACK EXPLICIT_OUTPUTS DOCS_DIR DOCS_CONFIG DOCS_VARS YT_SPEC USE_CXX USE_UTIL WHOLE_ARCHIVE PRIMARY_OUTPUT SECONDARY_OUTPUT DEPENDENCY_MANAGEMENT EXCLUDE NO_DOCTESTS EMBED_JAVA_VCS_INFO RESOURCE_FILES PACK_GLOBALS_IN_LIBRARY _EXPOSE GLOBAL_DEPS LIST_PROTO
  388. .FINAL_TARGET=no
  389. PEERDIR_TAGS=__EMPTY__
  390. PEERDIR+=$YMAKE_PYTHON3_PEERDIR
  391. when ($FATAL_ERROR_MESSAGE && $FATAL_ERROR_MODULE != "yes") {
  392. PEERDIR+=build/conf_fatal_error
  393. }
  394. DEFAULT(MODULE_VERSION)
  395. DEFAULT(MODULE_PREFIX)
  396. DEFAULT(MODULE_SUFFIX)
  397. }
  398. ### @usage: GEN_LIBRARY()
  399. ###
  400. ### Definition of a module that brings generated artefacts. This module can PEERDIRed
  401. ### from any module. The resulted module is empty and cleaned up during construction
  402. ### of the build graph.
  403. ###
  404. ### NOTE! SRCS macro is not supported for this library.
  405. module GEN_LIBRARY: _BARE_UNIT {
  406. .PROXY=yes
  407. .RESTRICTED=SRCS SRC
  408. .SEM=IGNORED
  409. # ENABLE(_FAKE_MODULE)
  410. SET(MODULE_SUFFIX .pkg.fake)
  411. }
  412. ### @usage: _BASE_UNIT # internal
  413. ###
  414. ### The base of all LIBRARY/PROGRAM modules describing common logic for all modules.
  415. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  416. module _BASE_UNIT: _BARE_UNIT {
  417. .GLOBAL=_FBS_NAMESPACE_MAP
  418. PEERDIR_TAGS=CPP_PROTO CPP_FBS H_IDL PY2 PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB
  419. CPP_PROTO_CMDLINE=${cwd;rootdir;input:File} $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --cpp_out=${CPP_PROTO_PLUGINS}$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $_PROTOC_FLAGS $PROTOC_STYLEGUIDE_OUT $PROTOC_PLUGIN_STYLEGUIDE ${input;rootrel:File} ${hide:PROTO_FAKEID}
  420. CPP_PROTO_OUTS+=${output;hide;norel;nopath;noext:File.pb.cc} ${output;main;hide;norel;nopath;noext:File.pb.h}
  421. CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.pb.h}
  422. CPP_EV_OUTS+=${output;hide;norel:File.pb.cc} ${output;hide;norel:File.pb.h}
  423. CPP_EV_OUTS_SEM+=${output;hide;norel:File.pb.h}
  424. when ($SWIG_LANG == "perl") {
  425. _SWIG_CMD=$_SWIG_PERL_CMD
  426. _SWIG_PEERDIR=contrib/tools/swig/Lib/perl5 build/platform/perl
  427. }
  428. elsewhen ($SWIG_LANG == "python") {
  429. _SWIG_CMD=$_SWIG_PYTHON_CMD
  430. _SWIG_PEERDIR=contrib/tools/swig/Lib/python
  431. }
  432. elsewhen ($SWIG_LANG == "jni_cpp") {
  433. _SWIG_CMD=$_SWIG_JNI_CPP_CMD
  434. _SWIG_PEERDIR=contrib/tools/swig/Lib/java $_SWIG_JNI_PEERDIR
  435. }
  436. elsewhen ($SWIG_LANG == "java") {
  437. _SWIG_CMD=$_SWIG_JNI_CMD
  438. _SWIG_PEERDIR=contrib/tools/swig/Lib/java $_SWIG_JNI_PEERDIR
  439. }
  440. when ($PY_PROTOS_FOR == "yes") {
  441. _EVLOG_CMDLINE=$_PY_EVLOG_CMDLINE
  442. _PROTO_CMDLINE=$_PY_PROTO_CMDLINE
  443. }
  444. otherwise {
  445. _EVLOG_CMDLINE=$_CPP_EVLOG_CMDLINE
  446. _FBS_CMDLINE=$_CPP_FLATC_CMDLINE
  447. when ($BUILD_PROTO_AS_EVLOG == "yes") {
  448. _PROTO_CMDLINE=$_CPP_PROTO_EVLOG_CMDLINE
  449. }
  450. otherwise {
  451. _PROTO_CMDLINE=$_CPP_PROTO_CMDLINE
  452. }
  453. when ($USE_VANILLA_PROTOC == "yes") {
  454. PROTOC=${tool:"contrib/tools/protoc_std"}
  455. PROTOC_STYLEGUIDE_OUT=
  456. PROTOC_PLUGIN_STYLEGUIDE=
  457. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std
  458. _PROTO_CMDLINE=$_CPP_VANILLA_PROTO_CMDLINE
  459. }
  460. when ($PROTOC_TRANSITIVE_HEADERS == "no") {
  461. CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
  462. }
  463. }
  464. SANITIZER_DEFINED=no
  465. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  466. CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer
  467. LDFLAGS+=-fsanitize=$SANITIZER_TYPE
  468. SANITIZER_DEFINED=yes
  469. when ($CLANG) {
  470. CFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  471. LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  472. }
  473. }
  474. when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") {
  475. CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  476. LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  477. }
  478. POPULATE_CPP_COVERAGE_FLAGS()
  479. when ($NLG_COVERAGE && $NLG_COVERAGE != "no") {
  480. CFLAGS+=-DNLG_COVERAGE
  481. }
  482. when ($GCC) {
  483. select ($SANITIZER_TYPE) {
  484. "address" ? {
  485. LDFLAGS+=-static-libasan
  486. }
  487. "undefined" ? {
  488. LDFLAGS+=-static-libubsan
  489. }
  490. "thread" ? {
  491. PIE=yes
  492. LDFLAGS+=-static-libtsan
  493. }
  494. }
  495. }
  496. when ($HARDENING == "yes") {
  497. when ($CLANG) {
  498. CFLAGS+=-fstack-protector-all -D_hardening_enabled_
  499. LDFLAGS+=-z relro -z now -z noexecstack
  500. PIE=yes
  501. }
  502. }
  503. when ($USE_LTO == "yes") {
  504. when ($GCC) {
  505. CFLAGS+=-flto -fno-fat-lto-objects
  506. LDFLAGS+=-flto
  507. NO_LTO_CFLAGS=-fno-lto
  508. }
  509. when ($CLANG) {
  510. CFLAGS+=-flto
  511. LDFLAGS+=-flto
  512. NO_LTO_CFLAGS=-fno-lto
  513. }
  514. }
  515. when ($USE_THINLTO == "yes") {
  516. when ($GCC) {
  517. CFLAGS+=-flto=thin
  518. LDFLAGS+=-flto=thin
  519. NO_LTO_CFLAGS=-fno-lto
  520. }
  521. when ($CLANG) {
  522. CFLAGS+=-flto=thin
  523. LDFLAGS+=-flto=thin
  524. NO_LTO_CFLAGS=-fno-lto
  525. }
  526. }
  527. when ($CLANG) {
  528. when ($PGO_ADD == "yes") {
  529. CFLAGS+=-fprofile-instr-generate
  530. LDFLAGS+=-fprofile-instr-generate
  531. }
  532. when ($PGO_PATH) {
  533. CFLAGS+=-fprofile-instr-use=$PGO_PATH -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date
  534. LDFLAGS+=-fprofile-instr-use=$PGO_PATH
  535. }
  536. }
  537. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  538. PEERDIR+=$COMPILER_PLATFORM
  539. }
  540. when ($OS_LINUX && $NEED_PLATFORM_PEERDIRS == "yes") {
  541. PEERDIR+=contrib/libs/linux-headers
  542. # For discussion see DTCC-553
  543. MODULE_LICENSES_RESTRICTION_EXCEPTIONS+=contrib/libs/linux-headers
  544. }
  545. # Adding PEERDIR from trigger doesn't always work. In this case it
  546. # cause troubles in contrib/libs/libc_compat/ubuntu_14 under musl
  547. # Workaround this issue by setting variable with PEERDIR in trigger
  548. # and then adding PEERDIR to it's value unconditionally.
  549. when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  550. _UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14
  551. }
  552. otherwise {
  553. _UBUNTU_COMPAT_PEERDIR=
  554. }
  555. PEERDIR+=$_UBUNTU_COMPAT_PEERDIR
  556. when ($NORUNTIME != "yes") {
  557. PEERDIR+=contrib/libs/cxxsupp
  558. when ($MAPSMOBI_BUILD_TARGET == "yes") {
  559. PEERDIR+=build/platform/mapkit
  560. }
  561. }
  562. when ($NOUTIL != "yes") {
  563. PEERDIR+=util
  564. }
  565. when ($MUSL == "yes") {
  566. CFLAGS += -D_musl_
  567. LINK_DYN_LIB_FLAGS += --musl
  568. LINK_SCRIPT_EXE_FLAGS += --musl
  569. PEERDIR+=contrib/libs/musl/include
  570. }
  571. # g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
  572. # The same problem exists for clang toolchain. On the other hand, the problem
  573. # doesn't affect cl since it has united C/C++ library and doesn't need
  574. # proxy C-headers.
  575. # Disable all C++ headers including proxy C-headers when we use libc++.
  576. when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
  577. CXXFLAGS += -nostdinc++
  578. }
  579. otherwise {
  580. CFLAGS += -DUSE_STL_SYSTEM
  581. }
  582. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  583. PEERDIR += build/external_resources/codenavigation
  584. }
  585. when ($CYTHON_COVERAGE && $CYTHON_COVERAGE == "yes") {
  586. CFLAGS+=-DCYTHON_TRACE=1 -DCYTHON_TRACE_NOGIL=1
  587. }
  588. DEFAULT(USE_SSE4 yes)
  589. when ($NOSSE != "yes") {
  590. CFLAGS+=$SSE_CFLAGS
  591. C_DEFINES+=$SSE_DEFINES
  592. when ($USE_SSE4 == "yes") {
  593. CFLAGS+=$SSE4_CFLAGS
  594. C_DEFINES+=$SSE4_DEFINES
  595. }
  596. }
  597. elsewhen ($MSVC != "yes") {
  598. CFLAGS += -mno-sse
  599. }
  600. POPULATE_CPP_COVERAGE_FLAGS()
  601. _REGISTER_NO_CHECK_IMPORTS()
  602. DEFAULT(PACKAGE_PREFIX_ARGS)
  603. DEFAULT(SWIG_LANG python)
  604. DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
  605. when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") {
  606. PEERDIR+=build/platform/binutils
  607. }
  608. }
  609. _LINKER_ID=
  610. # GCC does not support -fuse-ld with an executable path,
  611. # only -fuse-ld=gold or -fuse-ld=lld.
  612. when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  613. when ($_LINKER_ID in [ "gold", "lld" ]) {
  614. PEERDIR+=build/platform/${_LINKER_ID}
  615. }
  616. }
  617. macro _USE_LINKER_IMPL(LINKER_ID...) {
  618. SET(_LINKER_ID $LINKER_ID)
  619. }
  620. macro _USE_LINKER() {
  621. _USE_LINKER_IMPL($_DEFAULT_LINKER_ID)
  622. }
  623. ### @usage: USE_LINKER_GOLD()
  624. ### Use gold linker for a program. This doesn't work in libraries
  625. macro USE_LINKER_GOLD() {
  626. _USE_LINKER_IMPL(gold)
  627. }
  628. COMMON_LINK_SETTINGS=
  629. LINK_ADDITIONAL_SECTIONS=
  630. LINK_ADDITIONAL_SECTIONS_COMMAND=
  631. when ($COMMON_LINK_SETTINGS == "yes") {
  632. when ($_LINKER_ID == "lld" && ($OS_LINUX == "yes" || $OS_ANDROID == "yes")) {
  633. LDFLAGS += -Wl,--gdb-index
  634. }
  635. when ($EMBED_LINKER_CREF == "yes") {
  636. LDFLAGS+=-Wl,--cref ${tmp;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  637. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_cref=${tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME}
  638. }
  639. elsewhen ($DUMP_LINKER_CREF == "yes") {
  640. LDFLAGS+=-Wl,--cref ${output;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  641. }
  642. when ($EMBED_LINKER_MAP == "yes") {
  643. LDFLAGS+=-Wl,-Map=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  644. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_map.${_LINKER_ID}=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  645. }
  646. elsewhen ($DUMP_LINKER_MAP == "yes") {
  647. LDFLAGS+=-Wl,-Map=${output;rootrel;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  648. }
  649. when ($USE_MKL == "yes") {
  650. NOPLATFORM=yes
  651. }
  652. when ($AUTOCHECK == "yes" && $OS_LINUX == "yes") {
  653. PEERDIR+=contrib/libs/libeatmydata
  654. # We can not use LICENSE_RESTRICTION_EXCEPTIONS() macro inside a trigger.
  655. # Duplicate its implementation here
  656. MODULE_LICENSES_RESTRICTION_EXCEPTIONS+=contrib/libs/libeatmydata
  657. }
  658. when ($USE_ARCADIA_LIBM == "yes") {
  659. PEERDIR+=contrib/libs/libm
  660. }
  661. when ($USE_ARCADIA_LIBM == "no") {
  662. C_SYSTEM_LIBRARIES+=-lm
  663. }
  664. when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") {
  665. when ($ALLOCATOR in [ "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "J", "LF", "LF_YT", "LF_DBG", "B", "BM", "C", "LOCKLESS", "YT", "YT_TCMALLOC", "YT_TCMALLOC_256K", "MIM", "HU", "PROFILED_HU", "THREAD_PROFILED_HU" ]) {
  666. PEERDIR+=library/cpp/malloc/system
  667. }
  668. }
  669. otherwise {
  670. select ($ALLOCATOR) {
  671. "MIM" ? {
  672. PEERDIR+=library/cpp/malloc/mimalloc
  673. }
  674. "HU" ? {
  675. PEERDIR+=library/cpp/malloc/hu
  676. }
  677. "PROFILED_HU" ? {
  678. PEERDIR+=library/cpp/malloc/profiled_hu
  679. }
  680. "THREAD_PROFILED_HU" ? {
  681. PEERDIR+=library/cpp/malloc/thread_profiled_hu
  682. }
  683. "TCMALLOC_256K" ? {
  684. PEERDIR+=library/cpp/malloc/tcmalloc
  685. PEERDIR+=contrib/libs/tcmalloc
  686. }
  687. "TCMALLOC_SMALL_BUT_SLOW" ? {
  688. PEERDIR+=library/cpp/malloc/tcmalloc
  689. PEERDIR+=contrib/libs/tcmalloc/small_but_slow
  690. }
  691. "TCMALLOC_NUMA_256K" ? {
  692. PEERDIR+=library/cpp/malloc/tcmalloc
  693. PEERDIR+=contrib/libs/tcmalloc/numa_256k
  694. }
  695. "TCMALLOC_NUMA_LARGE_PAGES" ? {
  696. PEERDIR+=library/cpp/malloc/tcmalloc
  697. PEERDIR+=contrib/libs/tcmalloc/numa_large_pages
  698. }
  699. "TCMALLOC" ? {
  700. PEERDIR+=library/cpp/malloc/tcmalloc
  701. PEERDIR+=contrib/libs/tcmalloc/default
  702. }
  703. "TCMALLOC_TC" ? {
  704. PEERDIR+=library/cpp/malloc/tcmalloc
  705. PEERDIR+=contrib/libs/tcmalloc/no_percpu_cache
  706. }
  707. "GOOGLE" ? {
  708. PEERDIR+=library/cpp/malloc/galloc
  709. }
  710. "J" ? {
  711. when ($WIN32 == "yes") {
  712. PEERDIR+=library/cpp/malloc/system
  713. }
  714. otherwise {
  715. PEERDIR+=library/cpp/malloc/jemalloc
  716. }
  717. }
  718. "LF" ? {
  719. PEERDIR+=library/cpp/lfalloc
  720. }
  721. "LF_YT" ? {
  722. PEERDIR+=library/cpp/lfalloc/yt
  723. }
  724. "LF_DBG" ? {
  725. PEERDIR+=library/cpp/lfalloc/dbg
  726. }
  727. "B" ? {
  728. PEERDIR+=library/cpp/balloc
  729. }
  730. "BM" ? {
  731. PEERDIR+=library/cpp/balloc_market
  732. }
  733. "C" ? {
  734. PEERDIR+=library/cpp/malloc/calloc
  735. }
  736. "LOCKLESS" ? {
  737. PEERDIR+=library/cpp/malloc/lockless
  738. }
  739. "YT" ? {
  740. PEERDIR+=library/cpp/ytalloc/impl
  741. }
  742. "YT_TCMALLOC" ? {
  743. PEERDIR+=library/cpp/malloc/tcmalloc
  744. PEERDIR+=contrib/libs/yt_tcmalloc/default
  745. }
  746. "YT_TCMALLOC_256K" ? {
  747. PEERDIR+=library/cpp/malloc/tcmalloc
  748. PEERDIR+=contrib/libs/yt_tcmalloc
  749. }
  750. }
  751. }
  752. when ($ALLOCATOR == "SYSTEM") {
  753. PEERDIR+=library/cpp/malloc/system
  754. }
  755. when ($WERROR != "no") {
  756. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  757. C_WARNING_OPTS += $WERROR_FLAG
  758. }
  759. }
  760. when ($ICC == "yes") {
  761. PEERDIR+=contrib/libs/intel/core
  762. }
  763. when ($WITH_VALGRIND == "yes") {
  764. PEERDIR+=contrib/libs/valgrind
  765. # https://st.yandex-team.ru/DTCC-122
  766. CFLAGS+=-fdebug-default-version=4
  767. }
  768. }
  769. when ($EMBED_LINKER_MAP == "yes" || $EMBED_LINKER_CREF == "yes") {
  770. LINK_ADDITIONAL_SECTIONS_COMMAND+= \
  771. $OBJCOPY_TOOL $LINK_ADDITIONAL_SECTIONS $TARGET
  772. }
  773. _SO_EXT_FILTER=${ext=.so:PEERS} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/:PEERS}
  774. when ($OS_WINDOWS == "yes") {
  775. _SO_EXT_FILTER=${ext=.dll:PEERS} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/:PEERS}
  776. }
  777. elsewhen ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  778. _SO_EXT_FILTER=${ext=.dylib:PEERS} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/:PEERS}
  779. }
  780. LINK_OR_COPY_SO_CMD=
  781. RPATH_GLOBAL=
  782. when ($SO_OUTPUTS == "yes") {
  783. LINK_OR_COPY_SO_CMD=$FS_TOOLS link_or_copy_to_dir --no-check $_SO_EXT_FILTER ${BINDIR}
  784. LDFLAGS+=$RPATH_GLOBAL
  785. }
  786. # tag:restricted tag:DLL
  787. ### $usage: WITH_DYNAMIC_LIBS() # restricted
  788. ###
  789. ### Include dynamic libraries as extra PROGRAM/DLL outputs
  790. macro WITH_DYNAMIC_LIBS() {
  791. ENABLE(SO_OUTPUTS)
  792. }
  793. # tag:internal
  794. ### $usage: REAL_LINK_EXE_IMPL(peers...) # internal
  795. macro REAL_LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  796. .CMD=$REAL_LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  797. }
  798. # tag:internal
  799. ### $usage: REAL_LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  800. macro REAL_LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  801. .CMD=$REAL_LINK_EXEC_DYN_LIB_CMDLINE
  802. }
  803. # tag:internal
  804. ### $usage: REAL_LINK_DYN_LIB_IMPL(peers...) # internal
  805. macro REAL_LINK_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  806. .CMD=$REAL_LINK_DYN_LIB_CMDLINE && $LINK_OR_COPY_SO_CMD
  807. }
  808. # tag:internal
  809. ### $usage: LINK_EXE_IMPL(peers...) # internal
  810. macro LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  811. .CMD=$LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  812. }
  813. # tag:internal
  814. ### $usage: LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  815. macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  816. .CMD=$LINK_EXEC_DYN_LIB_CMDLINE
  817. }
  818. # tag:internal
  819. ### @usage: _LINK_UNIT # internal
  820. ###
  821. ### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
  822. module _LINK_UNIT: _BASE_UNIT {
  823. .EXTS=.o .obj .supp .tidyjson .ld
  824. .CMD=LINK_EXE
  825. .ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  826. .NODE_TYPE=Program
  827. .PEERDIR_POLICY=as_build_from
  828. .FINAL_TARGET=yes
  829. .DEFAULT_NAME_GENERATOR=DirName
  830. .ARGS_PARSER=Base
  831. DEFAULT(ALLOCATOR $DEFAULT_ALLOCATOR)
  832. _USE_LINKER()
  833. #link with libunwind manually
  834. when ($DARWIN == "yes" && $NOPLATFORM != "yes") {
  835. PEERDIR += contrib/libs/cxxsupp
  836. }
  837. when ($NEED_PROFILE_RUNTIME == "yes") {
  838. when ($CLANG16 == "yes") {
  839. LDFLAGS+=-resource-dir=contrib/libs/clang-rt
  840. PEERDIR+=contrib/libs/clang16-rt/lib/profile
  841. }
  842. otherwise {
  843. LDFLAGS+=-resource-dir=contrib/libs/clang-rt
  844. PEERDIR+=contrib/libs/clang14-rt/lib/profile
  845. }
  846. }
  847. when ($USE_LIBCXXRT == "yes") {
  848. PEERDIR += contrib/libs/cxxsupp/libcxxrt
  849. }
  850. when ($USE_DYNAMIC_CUDA == "yes") {
  851. LINK_DYN_LIB_FLAGS += --dynamic-cuda
  852. LINK_SCRIPT_EXE_FLAGS += --dynamic-cuda
  853. }
  854. when ($OPENSOURCE == "yes" && $AUTOCHECK == "yes") {
  855. # FIXME: Replace AUTOCHECK == yes with _not a host platform_ check after YMAKE-218
  856. MODULE_LICENSES_RESTRICTION_TYPES = DENY
  857. MODULE_LICENSES_RESTRICTIONS = REQUIRE_DISCLOSURE FORBIDDEN NDA
  858. }
  859. when ($OS_IOS == "yes" || $OS_ANDROID == "yes" || $MAPSMOBI_BUILD_TARGET == "yes") {
  860. MODULE_LICENSES_RESTRICTION_TYPES = DENY
  861. MODULE_LICENSES_RESTRICTIONS = REQUIRE_DISCLOSURE FORBIDDEN NDA
  862. }
  863. ENABLE(COMMON_LINK_SETTINGS)
  864. CHECK_PROVIDES()
  865. }
  866. MODULE_TYPE=UNKNOWN
  867. macro ADD_CLANG_TIDY() {
  868. ADD_YTEST($MODULE_PREFIX$REALPRJNAME clang_tidy)
  869. when ($TIDY_ENABLED == "yes") {
  870. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json
  871. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json
  872. }
  873. }
  874. # tag:internal
  875. ### @usage: _BASE_PROGRAM # internal
  876. ###
  877. ### The base of all programs. It adds dependencies to make final artefact complete and runnable.
  878. module _BASE_PROGRAM: _LINK_UNIT {
  879. .SYMLINK_POLICY=EXE
  880. .ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE
  881. .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  882. SET(MODULE_TYPE PROGRAM)
  883. SET(MODULE_LANG CPP)
  884. FORCE_COVERAGE_ENABLED=yes
  885. when ($OS_IOS == "yes") {
  886. EXTS+=.ios.interface
  887. }
  888. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  889. MODULE_SUFFIX=.exe
  890. }
  891. when ($TIDY_ENABLED == "yes") {
  892. MODULE_SUFFIX=.tidyjson
  893. }
  894. when ($MSVC != "yes" && $NOPLATFORM != "yes" && $WITH_VALGRIND != "yes" && $USE_ASMLIB != "no" && $MIC_ARCH != "yes" && $PIC != "yes" && $PIE != "yes") {
  895. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes" && $MUSL != "yes" && $SANITIZER_DEFINED != "yes" && $USE_THINLTO != "yes") {
  896. PEERDIR+=contrib/libs/glibcasm
  897. }
  898. otherwise {
  899. PEERDIR+=contrib/libs/asmlib
  900. }
  901. }
  902. when ($MUSL == "yes") {
  903. when ($MUSL_LITE == "yes") {
  904. PEERDIR += contrib/libs/musl
  905. }
  906. otherwise {
  907. PEERDIR += contrib/libs/musl/full
  908. }
  909. }
  910. DEFAULT(CPU_CHECK yes)
  911. when ($USE_SSE4 != "yes" || $NOUTIL == "yes" || $ALLOCATOR == "FAKE") {
  912. CPU_CHECK = no
  913. }
  914. when ($CPU_CHECK == "yes") {
  915. PEERDIR += library/cpp/cpuid_check
  916. }
  917. when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
  918. PEERDIR += library/cpp/execprofile/autostart
  919. }
  920. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  921. PEERDIR += contrib/libs/cxxsupp/libsan
  922. when ($CLANG) {
  923. select ($TARGET_PLATFORM) {
  924. "LINUX" ? {
  925. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/static
  926. }
  927. "DARWIN" ? {
  928. # Memory sanitizer is not supported for darwin platform.
  929. # https://clang.llvm.org/docs/MemorySanitizer.html#supported-platforms
  930. when ($SANITIZER_TYPE != "memory") {
  931. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/dynamic
  932. }
  933. }
  934. default ? {
  935. FATAL_ERROR_MESSAGE+=Unsupported platform for sanitizer
  936. }
  937. }
  938. }
  939. }
  940. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  941. PEERDIR+=library/cpp/testing/dump_clang_coverage
  942. }
  943. when ($IDE_MSVS == "yes") {
  944. PEERDIR+=build/scripts/c_templates
  945. }
  946. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  947. LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  948. }
  949. }
  950. VCS_INFO_SEM=vcs_info ${input;hide:"build/scripts/vcs_info.py"} ${input;hide:"build/scripts/c_templates/svn_interface.c"} ${input;hide:"build/scripts/c_templates/svnversion.h"}
  951. CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  952. && ${VCS_INFO_SEM} \
  953. && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE \
  954. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  955. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  956. && target_compile_options PRIVATE $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  957. ### @usage: PROGRAM([progname])
  958. ###
  959. ### Regular program module.
  960. ### If name is not specified it will be generated from the name of the containing project directory.
  961. module PROGRAM: _BASE_PROGRAM {
  962. .SEM=CPP_PROGRAM_SEM
  963. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  964. ADD_CLANG_TIDY()
  965. _DONT_REQUIRE_LICENSE()
  966. }
  967. ### @usage: EXPORTS_SCRIPT(exports_file)
  968. ###
  969. ### Specify exports script within PROGRAM, DLL and DLL-derived modules.
  970. ### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
  971. ### The other option use EXPORTS parameter of the DLL module itself.
  972. ###
  973. ### @see: [DLL](#module_DLL)
  974. macro EXPORTS_SCRIPT(Arg) {
  975. SET(EXPORTS_FILE $Arg)
  976. }
  977. ### @usage: NO_EXPORT_DYNAMIC_SYMBOLS()
  978. ###
  979. ### Disable exporting all non-hidden symbols as dynamic when linking a PROGRAM.
  980. macro NO_EXPORT_DYNAMIC_SYMBOLS() {
  981. ENABLE(NO_EXPORT_DYNAMIC_SYMBOLS)
  982. }
  983. ### @usage: EXPORT_ALL_DYNAMIC_SYMBOLS()
  984. ###
  985. ### Export all non-hidden symbols as dynamic when linking a PROGRAM.
  986. macro EXPORT_ALL_DYNAMIC_SYMBOLS() {
  987. # Dummy: default behaviour
  988. ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS)
  989. }
  990. ### @usage: USE_DYNAMIC_CUDA()
  991. ###
  992. ### Enable linking of PROGRAM with dynamic CUDA. By default CUDA uses static linking
  993. macro USE_DYNAMIC_CUDA() {
  994. LDFLAGS(-Wl,-rpath,$ORIGIN)
  995. ENABLE(USE_DYNAMIC_CUDA)
  996. }
  997. ### @usage: CUSTOM_LINK_STEP_SCRIPT(name)
  998. ###
  999. ### Specifies name of a script for custom link step. The scripts
  1000. ### should be placed in the build/scripts directory and are subject to
  1001. ### review by devtools@.
  1002. macro CUSTOM_LINK_STEP_SCRIPT(Name) {
  1003. SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name)
  1004. }
  1005. ### @usage: _BASE_UNITTEST # internal
  1006. ###
  1007. ### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery.
  1008. module _BASE_UNITTEST: _BASE_PROGRAM {
  1009. .FINAL_TARGET=no
  1010. .NODE_TYPE=Program
  1011. .ALLOWED=YT_SPEC
  1012. when ($UT_SKIP_EXCEPTIONS == "yes") {
  1013. C_DEFINES+=-DUT_SKIP_EXCEPTIONS
  1014. }
  1015. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1016. # Assume that no code may depend on unit test output and thus
  1017. # do not mandate license markup in such modules.
  1018. _DONT_REQUIRE_LICENSE()
  1019. }
  1020. _TEST_SPLIT_FACTOR_SEM=1
  1021. _TEST_TIMEOUT_SEM=
  1022. _TEST_PARTITION_SEM=
  1023. UNITTEST_SEM=$CPP_PROGRAM_SEM \
  1024. && set_property TARGET $REALPRJNAME PROPERTY SPLIT_FACTOR $_TEST_SPLIT_FACTOR_SEM \
  1025. $_TEST_PARTITION_SEM \
  1026. && add_yunittest NAME $REALPRJNAME TEST_TARGET $REALPRJNAME TEST_ARG --print-before-suite --print-before-test --fork-tests --print-times --show-fails \
  1027. && set_yunittest_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1028. && add_ytest_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1029. $_TEST_TIMEOUT_SEM
  1030. # tag:test
  1031. ### @usage: UNITTEST([name])
  1032. ###
  1033. ### Unit test module based on library/cpp/testing/unittest.
  1034. ### It is recommended not to specify the name.
  1035. ###
  1036. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#opisanievya.make1
  1037. module UNITTEST: _BASE_UNITTEST {
  1038. .SEM=UNITTEST_SEM
  1039. .DEFAULT_NAME_GENERATOR=FullPath
  1040. .ARGS_PARSER=Base
  1041. PEERDIR(library/cpp/testing/unittest_main)
  1042. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1043. when ($TEST_FORK_MODE != "none") {
  1044. when ($TEST_SPLIT_FACTOR) {
  1045. _TEST_SPLIT_FACTOR_SEM=$TEST_SPLIT_FACTOR
  1046. }
  1047. otherwise {
  1048. _TEST_SPLIT_FACTOR_SEM=10
  1049. }
  1050. when ($TEST_PARTITION == "MODULO") {
  1051. _TEST_PARTITION_SEM=&& set_property TARGET $REALPRJNAME PROPERTY SPLIT_TYPE $TEST_PARTITION \
  1052. }
  1053. }
  1054. when ($TEST_TIMEOUT) {
  1055. _TEST_TIMEOUT_SEM=&& set_yunittest_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1056. }
  1057. }
  1058. # tag:yt-specific tag:test
  1059. ### @usage: YT_UNITTEST([name])
  1060. ###
  1061. ### YT Unit test module based on library/cpp/testing/unittest with NYT::Initialize hook
  1062. module YT_UNITTEST: _BASE_UNITTEST {
  1063. PEERDIR(library/cpp/testing/unittest_main mapreduce/yt/tests/yt_initialize_hook)
  1064. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1065. }
  1066. # tag:test
  1067. ### @usage: UNITTEST_WITH_CUSTOM_ENTRY_POINT([name])
  1068. ###
  1069. ### Generic unit test module.
  1070. module UNITTEST_WITH_CUSTOM_ENTRY_POINT: _BASE_UNITTEST {
  1071. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1072. }
  1073. GTEST_SEM=$CPP_PROGRAM_SEM \
  1074. && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
  1075. && set_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1076. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1077. $_TEST_TIMEOUT_SEM
  1078. # tag:cpp-specific tag:test
  1079. ### @usage: GTEST([name])
  1080. ###
  1081. ### Unit test module based on library/cpp/testing/gtest.
  1082. ### It is recommended not to specify the name.
  1083. ###
  1084. ### Documentation: https://docs.yandex-team.ru/arcadia-cpp/cpp_test
  1085. module GTEST: _BASE_UNITTEST {
  1086. .SEM=GTEST_SEM
  1087. .DEFAULT_NAME_GENERATOR=FullPath
  1088. .ARGS_PARSER=Base
  1089. PEERDIR(library/cpp/testing/gtest library/cpp/testing/gtest_main)
  1090. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gunittest)
  1091. when ($TEST_TIMEOUT) {
  1092. _TEST_TIMEOUT_SEM=&& set_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1093. }
  1094. }
  1095. USE_AFL=no
  1096. # tag:fuzzing
  1097. ### @usage: FUZZ()
  1098. ###
  1099. ### In order to start using Fuzzing in Arcadia, you need to create a FUZZ module with the implementation of the function LLVMFuzzerTestOneInput().
  1100. ### This module should be reachable by RECURSE from /autocheck project in order for the corpus to be regularly updated.
  1101. ### AFL and Libfuzzer are supported in Arcadia via a single interface, but the automatic fuzzing still works only through Libfuzzer.
  1102. ###
  1103. ### Example: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/re2/re2/fuzzing/re2_fuzzer.cc?rev=2919463#L58
  1104. ###
  1105. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1106. module FUZZ: _BASE_PROGRAM {
  1107. .NODE_TYPE=Program
  1108. .FINAL_TARGET=no
  1109. .ALLOWED=FUZZ_DICTS FUZZ_OPTS
  1110. SET(LIBFUZZER_PATH contrib/libs/libfuzzer)
  1111. when ($USE_AFL == "no") {
  1112. PEERDIR+=$LIBFUZZER_PATH
  1113. }
  1114. when ($USE_AFL == "yes") {
  1115. PEERDIR+=$LIBFUZZER_PATH/afl
  1116. }
  1117. when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
  1118. PEERDIR+=library/cpp/testing/nofuzz
  1119. }
  1120. ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)
  1121. }
  1122. # tag:ios-specific
  1123. PACK_IOS_CMD=
  1124. when ($OS_IOS && $BUILD_IOS_APP) {
  1125. PACK_IOS_CMD=$YMAKE_PYTHON ${input:"build/scripts/pack_ios.py"} --binary $TARGET --target $TARGET --temp-dir $BINDIR $PEERS
  1126. }
  1127. LINK_BOOSTTEST_CMD=
  1128. BOOST_TEST_TYPE_STRING=
  1129. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1130. LINK_BOOSTTEST_CMD=$LINK_RECURSIVE_LIBRARY
  1131. BOOST_TEST_TYPE_STRING=no.test
  1132. }
  1133. otherwise {
  1134. LINK_BOOSTTEST_CMD=$LINK_EXE
  1135. BOOST_TEST_TYPE_STRING=boost.test
  1136. }
  1137. # tag:deprecated
  1138. ### @usage: BOOSTTEST([name]) #deprecated
  1139. ###
  1140. ### Test module based on boost/test/unit_test.hpp.
  1141. ### As with entire boost library usage of this technology is deprecated in Arcadia and restricted with configuration error in most of projects.
  1142. ### No new module of this type should be introduced unless it is explicitly approved by C++ committee.
  1143. module BOOSTTEST: _BASE_PROGRAM {
  1144. .NODE_TYPE=Program
  1145. .FINAL_TARGET=no
  1146. .CMD=LINK_BOOSTTEST_CMD
  1147. PEERDIR(library/cpp/testing/boost_test)
  1148. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1149. MODULE_SUFFIX=.a
  1150. }
  1151. elsewhen ($OS_IOS && $BUILD_IOS_APP) {
  1152. PEERDIR+=devtools/boosttest_ios_wrapper/library
  1153. MODULE_SUFFIX=.ios.tar
  1154. }
  1155. ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING)
  1156. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1157. _DONT_REQUIRE_LICENSE()
  1158. }
  1159. # tag:deprecated
  1160. ### @usage BOOSTTEST_WITH_MAIN([name]) #deprecated
  1161. ###
  1162. ### Same as BOOSTTEST (see above), but comes with builtin int main(argc, argv) implementation
  1163. module BOOSTTEST_WITH_MAIN: BOOSTTEST {
  1164. PEERDIR(library/cpp/testing/boost_test_main)
  1165. }
  1166. FUZZ_DICTS_VALUE=
  1167. ### @usage: FUZZ_DICTS(path1 [path2...])
  1168. ###
  1169. ### Allows you to specify dictionaries, relative to the root of Arcadia, which will be used in Fuzzing.
  1170. ### Libfuzzer and AFL use a single syntax for dictionary descriptions.
  1171. ### Should only be used in FUZZ modules.
  1172. ###
  1173. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1174. macro FUZZ_DICTS(Data...) {
  1175. SET_APPEND(FUZZ_DICTS_VALUE $Data)
  1176. }
  1177. FUZZ_OPTS_VALUE=
  1178. ### @usage: FUZZ_OPTS(opt1 [Opt2...])
  1179. ###
  1180. ### Overrides or adds options to the corpus mining and fuzzer run.
  1181. ### Currently supported only Libfuzzer, so you should use the options for it.
  1182. ### Should only be used in FUZZ modules.
  1183. ###
  1184. ### @example:
  1185. ###
  1186. ### FUZZ_OPTS (
  1187. ### -max_len=1024
  1188. ### -rss_limit_mb=8192
  1189. ### )
  1190. ###
  1191. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1192. macro FUZZ_OPTS(Data...) {
  1193. SET_APPEND(FUZZ_OPTS_VALUE $Data)
  1194. }
  1195. # tag:yt-specific tag:test
  1196. TEST_YT_SPEC_VALUE=
  1197. ### @usage: YT_SPEC(path1 [path2...])
  1198. ###
  1199. ### Allows you to specify json-files with YT task and operation specs,
  1200. ### which will be used to run test node in the YT.
  1201. ### Test must be marked with ya:yt tag.
  1202. ### Files must be relative to the root of Arcadia.
  1203. ###
  1204. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1205. macro YT_SPEC(Data...) {
  1206. SET_APPEND(TEST_YT_SPEC_VALUE $Data)
  1207. }
  1208. # tag:test
  1209. TEST_SRCS_VALUE=
  1210. ### @usage: TEST_SRCS(Files...)
  1211. ###
  1212. ### In PY2TEST, PY3TEST and PY*_LIBRARY modules used as PY_SRCS macro and additionally used to mine test cases to be executed by testing framework.
  1213. ###
  1214. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  1215. macro TEST_SRCS(Tests...) {
  1216. SET_APPEND(TEST_SRCS_VALUE $Tests)
  1217. }
  1218. macro DISABLE_DATA_VALIDATION() {
  1219. DISABLE(VALIDATE_DATA)
  1220. }
  1221. # tag:test
  1222. TEST_DATA_VALUE=
  1223. ### @usage: DATA([path...])
  1224. ###
  1225. ### Specifies the path to the data necessary test.
  1226. ### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>.
  1227. ### In the latter case resource will be brought to the working directory of the test before it is started
  1228. ###
  1229. ### Used only inside TEST modules.
  1230. ###
  1231. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1232. macro DATA(Data...) {
  1233. SET_APPEND(TEST_DATA_VALUE $Data)
  1234. ADD_CHECK(check.data $Data)
  1235. }
  1236. # tag:test
  1237. ### @usage: DATA_FILES([path...])
  1238. ###
  1239. ### Specifies the path to the arcadia source data necessary test.
  1240. ### Used only inside TEST modules.
  1241. ###
  1242. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1243. macro DATA_FILES(Paths...) {
  1244. SET_APPEND(TEST_DATA_VALUE ${pre=arcadia/:Paths})
  1245. _DATA_FILES($Paths)
  1246. }
  1247. # tag:test
  1248. ### @usage: EXPLICIT_DATA()
  1249. ###
  1250. ### Disables implicit macro DATA(<module_path>).
  1251. ADD_SRCDIR_TO_TEST_DATA=yes
  1252. macro EXPLICIT_DATA() {
  1253. SET(ADD_SRCDIR_TO_TEST_DATA no)
  1254. }
  1255. # tag:test
  1256. TEST_TAGS_VALUE=
  1257. ### @usage: TAG ([tag...])
  1258. ###
  1259. ### Each test can have one or more tags used to filter tests list for running.
  1260. ### There are also special tags affecting test behaviour, for example ya:external, sb:ssd.
  1261. ###
  1262. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija
  1263. macro TAG(Tags...) {
  1264. SET_APPEND(TEST_TAGS_VALUE $Tags)
  1265. }
  1266. # tag:test
  1267. TEST_REQUIREMENTS_VALUE=
  1268. ### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64])
  1269. ###
  1270. ### Allows you to specify the requirements of the test.
  1271. ###
  1272. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1273. macro REQUIREMENTS(Tags...) {
  1274. SET_APPEND(TEST_REQUIREMENTS_VALUE $Tags)
  1275. }
  1276. # tag:test
  1277. TEST_ENV_VALUE=
  1278. ### @usage: ENV(key[=value])
  1279. ###
  1280. ### Sets env variable key to value (gets value from system env by default).
  1281. macro ENV(Data...) {
  1282. SET_APPEND(TEST_ENV_VALUE ${quo:Data})
  1283. }
  1284. ### @usage: CONFTEST_LOAD_POLICY_LOCAL()
  1285. ###
  1286. ### Loads conftest.py files in a way that pytest does it
  1287. macro CONFTEST_LOAD_POLICY_LOCAL() {
  1288. SET_APPEND(TEST_ENV_VALUE "CONFTEST_LOAD_POLICY=LOCAL")
  1289. }
  1290. # tag:test
  1291. TEST_RECIPES_VALUE=
  1292. ### @usage: USE_RECIPE(path [arg1 arg2...])
  1293. ###
  1294. ### Provides prepared environment via recipe for test.
  1295. ###
  1296. ### Documentation: https://wiki.yandex-team.ru/yatool/test/recipes
  1297. macro USE_RECIPE(Data...) {
  1298. SET_APPEND(TEST_RECIPES_VALUE $Data)
  1299. SET_APPEND(TEST_RECIPES_VALUE "USE_RECIPE_DELIM")
  1300. }
  1301. # tag:python-specific tag:test
  1302. TEST_PYTHON_PATH_VALUE=
  1303. # tag:python-specific tag:test
  1304. ### @usage: PYTHON_PATH(Path)
  1305. ###
  1306. ### Set path to Python that will be used to runs scripts in tests
  1307. macro PYTHON_PATH(Path) {
  1308. SET(TEST_PYTHON_PATH_VALUE $Path)
  1309. }
  1310. # tag:test
  1311. SKIP_TEST_VALUE=
  1312. ### @usage: SKIP_TEST(Reason)
  1313. ###
  1314. ### Skip the suite defined by test module. Provide a reason to be output in test execution report.
  1315. macro SKIP_TEST(Reason...) {
  1316. SET(SKIP_TEST_VALUE $Reason)
  1317. }
  1318. # tag:test
  1319. LINT_LEVEL_VALUE=extended
  1320. _NO_LINT_VALUE=
  1321. ### @usage: NO_LINT([ktlint])
  1322. ###
  1323. ### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS.
  1324. ### Ktlint can be disabled using NO_LINT(ktlint) explicitly.
  1325. macro NO_LINT(ktlint?"ktlint":"none") {
  1326. SET(_NO_LINT_VALUE ${ktlint})
  1327. }
  1328. ### @usage: LINT(<none|base|strict>)
  1329. ###
  1330. ### Set linting level for sources of the module
  1331. macro LINT(level) {
  1332. SET(LINT_LEVEL_VALUE $level)
  1333. }
  1334. # tag:cpp-specific tag:test
  1335. module CPP_STYLE_TEST_14: PY3TEST_BIN {
  1336. DEPENDS(contrib/libs/clang14/tools/clang-format)
  1337. PEERDIR+=library/python/cpp_test
  1338. }
  1339. macro STYLE(Globs...) {
  1340. _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
  1341. _STYLE(${STYLE_SRCS_GLOB})
  1342. }
  1343. # tag:test
  1344. ### @usage: EXECTEST()
  1345. ###
  1346. ### Module definition of generic test that executes a binary.
  1347. ### Use macro RUN to specify binary to run.
  1348. ###
  1349. ### @example:
  1350. ###
  1351. ### EXECTEST()
  1352. ### OWNER(g:yatool)
  1353. ###
  1354. ### RUN(
  1355. ### cat input.txt
  1356. ### )
  1357. ### DATA(
  1358. ### arcadia/devtools/ya/test/tests/exectest/data
  1359. ### )
  1360. ### DEPENDS(
  1361. ### devtools/dummy_arcadia/cat
  1362. ### )
  1363. ### TEST_CWD(devtools/ya/test/tests/exectest/data)
  1364. ### END()
  1365. ###
  1366. ### More examples: https://wiki.yandex-team.ru/yatool/test/#exec-testy
  1367. ###
  1368. ### @see: [RUN()](#macro_RUN)
  1369. module EXECTEST: _BARE_UNIT {
  1370. .NODE_TYPE=Program
  1371. .FINAL_TARGET=no
  1372. .ALLOWED=YT_SPEC
  1373. .RESTRICTED=FORK_TEST_FILES
  1374. .DEFAULT_NAME_GENERATOR=FullPath
  1375. .ARGS_PARSER=Base
  1376. SET(MODULE_SUFFIX .pkg.fake)
  1377. SETUP_EXECTEST()
  1378. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1379. }
  1380. # tag:cpp-specific tag:test
  1381. ### @usage: Y_BENCHMARK([benchmarkname])
  1382. ###
  1383. ### Benchmark test based on the library/cpp/testing/benchmark.
  1384. ###
  1385. ### For more details see: https://wiki.yandex-team.ru/yatool/test/#zapuskbenchmark
  1386. module Y_BENCHMARK: PROGRAM {
  1387. .SEM=CPP_PROGRAM_SEM
  1388. PEERDIR(library/cpp/testing/benchmark/main)
  1389. }
  1390. GBENCH_SEM=$CPP_PROGRAM_SEM \
  1391. && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
  1392. && set_property TEST $REALPRJNAME PROPERTY LABELS SMALL $FILTER_ONLY_TEST_TAGS \
  1393. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1394. $_TEST_TIMEOUT_SEM
  1395. # tag:cpp-specific tag:test
  1396. ### @usage: G_BENCHMARK([benchmarkname])
  1397. ###
  1398. ### Benchmark test based on the google benchmark.
  1399. ###
  1400. ### For more details see: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/benchmark/README.md
  1401. module G_BENCHMARK: _BASE_PROGRAM {
  1402. .SEM=GBENCH_SEM
  1403. .ALLOWED=YT_SPEC
  1404. PEERDIR(library/cpp/testing/gbenchmark)
  1405. ADD_YTEST($MODULE_PREFIX$REALPRJNAME g_benchmark)
  1406. }
  1407. # tag:test
  1408. TEST_ROOT=$(TESTS_DATA_ROOT)
  1409. RESULT_MAX_FILE=0
  1410. STRIP_FILES=--dont-strip-files
  1411. VERIFY_RESULTS=--verify-results
  1412. ADDITIONAL_PATH=
  1413. # set for tests variables to fill it by YA_DEV or YA
  1414. YA_ROOT=ya
  1415. when ($YA_DEV == "yes") {
  1416. YA_ROOT=ya-dev
  1417. }
  1418. # tag:test
  1419. ### @usage: UNITTEST_FOR(path/to/lib)
  1420. ###
  1421. ### Convenience extension of UNITTEST module.
  1422. ### The UNINTTEST module with additional SRCDIR + ADDINCL + PEERDIR on path/to/lib.
  1423. ### path/to/lib is the path to the directory with the LIBRARY project.
  1424. ###
  1425. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1426. module UNITTEST_FOR: UNITTEST {
  1427. .SEM=UNITTEST_SEM
  1428. PEERDIR(ADDINCL $UNITTEST_DIR)
  1429. SRCDIR($UNITTEST_DIR)
  1430. }
  1431. ### @usage: _LIBRARY # internal
  1432. ###
  1433. ### Base module definition for all libraries.
  1434. ### Contains basic logic like module properties, default variable values etc.
  1435. ### All libraries similar to C++-libraries should be inherited from it.
  1436. module _LIBRARY: _BASE_UNIT {
  1437. .CMD=LINK_LIB
  1438. .NODE_TYPE=Library
  1439. .PEERDIR_POLICY=as_include
  1440. .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
  1441. .ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  1442. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1443. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
  1444. .FINAL_TARGET=no
  1445. .GLOBAL_CMD=GLOBAL_LINK_LIB
  1446. .GLOBAL_EXTS=.o .obj .tidyjson
  1447. GLOBAL_SUFFIX=.global$MODULE_SUFFIX
  1448. #TODO: Remove this hack (really we do not need add fake src at all)
  1449. ENABLE(NEED_ADD_FAKE_SRC)
  1450. CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python)
  1451. when ($USE_MKL == "yes") {
  1452. NOPLATFORM=yes
  1453. }
  1454. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1455. MODULE_PREFIX=
  1456. MODULE_SUFFIX=.lib
  1457. }
  1458. otherwise {
  1459. when ($TIDY_ENABLED == "yes") {
  1460. MODULE_PREFIX=
  1461. MODULE_SUFFIX=.tidyjson
  1462. }
  1463. otherwise {
  1464. MODULE_PREFIX=lib
  1465. MODULE_SUFFIX=.a
  1466. }
  1467. }
  1468. when ($WERROR != "no") {
  1469. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  1470. C_WARNING_OPTS += $WERROR_FLAG
  1471. }
  1472. }
  1473. when ($WITH_VALGRIND == "yes") {
  1474. PEERDIR+=contrib/libs/valgrind
  1475. # https://st.yandex-team.ru/DTCC-1227
  1476. CFLAGS+=-fdebug-default-version=4
  1477. }
  1478. when ($USE_ARCADIA_LIBM == "yes") {
  1479. PEERDIR+=contrib/libs/libm
  1480. }
  1481. }
  1482. CPP_LIBRARY_INDUCED_SEM_PROPERTY=consumer_link_library
  1483. CPP_LIBRARY_SEM=add_library ${MODDIR} $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  1484. && library_fake_marker FAKE_MODULE ${FAKE_MODULE} \
  1485. && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET \
  1486. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  1487. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1488. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1489. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  1490. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW \
  1491. && add_language C && add_language CXX
  1492. CPP_OBJ_LIBRARY_SEM=add_global_library_for ${MODDIR} ${suf=.global:CMAKE_TARGET_NAME} $CMAKE_TARGET_NAME ${hide:GLOBAL_TARGET} ${hide:AUTO_INPUT} \
  1493. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  1494. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1495. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1496. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  1497. CMAKE_FIND_PKG=
  1498. CMAKE_LINK_TARGET=$REALPRJNAME
  1499. CMAKE_FIND_PKG_COMP=
  1500. CONAN_REQUIRE=
  1501. CONAN_OPTS_SEM=
  1502. ### @usage: LIBRARY()
  1503. ###
  1504. ### The regular static library module.
  1505. ###
  1506. ### The LIBRARY() is intermediate module, so when built directly it won't build its dependencies.
  1507. ### It transitively provides its PEERDIRs to ultimate final target, where all LIBRARY() modules are built and linked together.
  1508. ###
  1509. ### This is C++ library, and it selects peers from multimodules accordingly.
  1510. ###
  1511. ### It makes little sense to mention LIBRARY in DEPENDS or BUNDLE, package and deploy it since it is not a standalone entity.
  1512. ### In order to use library in tests PEERDIR it to link into tests.
  1513. ### If you think you need to distribute static library please contact devtools@ for assistance.
  1514. module LIBRARY: _LIBRARY {
  1515. .GLOBAL=_AARS _PROGUARD_RULES
  1516. .SEM=CPP_LIBRARY_SEM
  1517. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  1518. .DEFAULT_NAME_GENERATOR=ThreeDirNames
  1519. .ARGS_PARSER=Base
  1520. when ($CMAKE_PACKAGE_COMPONENT != "") {
  1521. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  1522. }
  1523. when ($CMAKE_PACKAGE != "") {
  1524. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  1525. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  1526. }
  1527. when ($CONAN_REFERENCE != "") {
  1528. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  1529. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  1530. }
  1531. when ($CONAN_PKG_OPTS != "") {
  1532. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  1533. }
  1534. when ($OPENSOURCE_EXPORT == "no") {
  1535. CPP_LIBRARY_SEM=IGNORED
  1536. }
  1537. when ($HAS_CPP_PROTOBUF_PEERS == "yes") {
  1538. PEERDIR+=$CPP_PROTOBUF_PEERS
  1539. }
  1540. SET(MODULE_TYPE LIBRARY)
  1541. SET(MODULE_LANG CPP)
  1542. ADD_CLANG_TIDY()
  1543. }
  1544. # tag:internal
  1545. ### @usage: _BARE_MODULE() # internal
  1546. ###
  1547. ### Remove unwanted dependencies for "empty" library module
  1548. macro _BARE_MODULE() {
  1549. SET(NEED_PLATFORM_PEERDIRS no)
  1550. SET(PEERDIR_TEST_TOOL no)
  1551. DISABLE(WITH_VALGRIND)
  1552. NO_CODENAVIGATION()
  1553. NO_PLATFORM()
  1554. NO_RUNTIME()
  1555. NO_UTIL()
  1556. NO_CLANG_TIDY()
  1557. }
  1558. # tag:internal
  1559. ### @usage: _BARE_LINK_MODULE() # internal
  1560. ###
  1561. ### Remove unwanted dependencies for "empty" link module
  1562. macro _BARE_LINK_MODULE() {
  1563. _BARE_MODULE()
  1564. DISABLE(COMMON_LINK_SETTINGS)
  1565. ALLOCATOR(FAKE)
  1566. }
  1567. # tag:internal
  1568. ### @usage: _CONDITIONAL_SRCS([USE_CONDITIONAL_SRCS] Files...) # internal
  1569. ###
  1570. ### Adds Files... to SRCS if first word is `USE_CONDITIONAL_SRCS`
  1571. ### To be used with some variable which is set to `USE_CONDITIONAL_SRCS` under condition
  1572. macro _CONDITIONAL_SRCS(USE_CONDITIONAL_SRCS[], DYMMY...) {
  1573. SRCS($USE_CONDITIONAL_SRCS)
  1574. }
  1575. # XXX: dirty hack for correct LDFLAGS passing
  1576. RESOURCES_LIBRARY_LINK=$TOUCH_UNIT
  1577. RESOURCES_LIBRARY_SEM=IGNORED
  1578. ### @usage: RESOURCES_LIBRARY()
  1579. ###
  1580. ### Definition of a module that brings its content from external source (Sandbox) via DECLARE_EXTERNAL_RESOURCE macro.
  1581. ### This can participate in PEERDIRs of others as library but it cannot have own sources and PEERDIRs.
  1582. ###
  1583. ### @see: [DECLARE_EXTERNAL_RESOURCE()](#macro_DECLARE_EXTERNAL_RESOURCE)
  1584. module RESOURCES_LIBRARY: _BARE_UNIT {
  1585. .CMD=RESOURCES_LIBRARY_LINK
  1586. .SEM=RESOURCES_LIBRARY_SEM
  1587. .ALLOWED=DECLARE_EXTERNAL_RESOURCE EXTRALIBS OBJADDE_GLOBAL
  1588. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SRC SRCS PEERDIR SPLIT_DWARF
  1589. .NODE_TYPE=Library
  1590. .PEERDIR_POLICY=as_include
  1591. .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
  1592. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1593. when ($CMAKE_PACKAGE_COMPONENT != "") {
  1594. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  1595. }
  1596. when ($CMAKE_PACKAGE != "") {
  1597. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  1598. RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  1599. }
  1600. when ($CONAN_REFERENCE != "") {
  1601. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  1602. RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  1603. }
  1604. when ($CONAN_PKG_OPTS != "") {
  1605. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  1606. }
  1607. MODULE_SUFFIX=.pkg.fake
  1608. ENABLE(NEED_ADD_FAKE_SRC)
  1609. WITHOUT_LICENSE_TEXTS()
  1610. }
  1611. FAT_OBJECT_SEM=add_fat_object ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  1612. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1613. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1614. && set_global_flags FAT_OBJECT_PREFIX ${MODULE_PREFIX} \
  1615. && set_global_flags FAT_OBJECT_SUFFIX ${MODULE_SUFFIX}
  1616. ### Do not turn visibility=hidden symbos into static symbos of partially linked object file
  1617. ###
  1618. ### Note: This variable do not have any effect on platforms other than MacOS and iOS.
  1619. KEEP_FAT_OBJECT_SYMBOLS=no
  1620. ### @usage: FAT_OBJECT()
  1621. ###
  1622. ### The "fat" object module. It will contain all its transitive dependencies reachable by PEERDIRs:
  1623. ### static libraries, local (from own SRCS) and global (from peers') object files.
  1624. ###
  1625. ### Designed for use in XCode projects for iOS.
  1626. module FAT_OBJECT: LIBRARY {
  1627. .ALLOWED=PACK_GLOBALS_IN_LIBRARY
  1628. .CMD=LINK_FAT_OBJECT
  1629. .SEM=FAT_OBJECT_SEM
  1630. .PEERDIR_POLICY=as_build_from
  1631. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1632. MODULE_SUFFIX=.lib
  1633. }
  1634. otherwise {
  1635. MODULE_SUFFIX=.a
  1636. }
  1637. when (($OS_DARWIN == "yes" || $OS_IOS == "yes") && $KEEP_FAT_OBJECT_SYMBOLS == "yes") {
  1638. LDFLAGS_GLOBAL += -keep_private_externs
  1639. }
  1640. when ($OS_IOS == "yes" || $OS_ANDROID == "yes" || $MAPSMOBI_BUILD_TARGET == "yes") {
  1641. MODULE_LICENSES_RESTRICTION_TYPES = DENY
  1642. MODULE_LICENSES_RESTRICTIONS = REQUIRE_DISCLOSURE FORBIDDEN NDA
  1643. }
  1644. # FIXME: This is weird legacy
  1645. when ($OS_ANDROID == "yes") {
  1646. MODULE_PREFIX=lib
  1647. }
  1648. otherwise {
  1649. MODULE_PREFIX=
  1650. }
  1651. _USE_LINKER()
  1652. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  1653. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  1654. DISABLE(NEED_ADD_FAKE_SRC)
  1655. SRCS(build/scripts/_fake_src.cpp)
  1656. }
  1657. RECURSIVE_LIBRARY_SEM=add_recursive_library ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  1658. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  1659. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1660. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1661. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  1662. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW
  1663. ### @usage: RECURSIVE_LIBRARY()
  1664. ###
  1665. ### The recursive ("fat") library module. It will contain all its transitive dependencies reachable by PEERDIRs:
  1666. ### from static libraries, local (from own SRCS) and global (from peers') object files.
  1667. ###
  1668. ### Designed for use in XCode projects for iOS.
  1669. module RECURSIVE_LIBRARY: LIBRARY {
  1670. .CMD=LINK_RECURSIVE_LIBRARY
  1671. .SEM=RECURSIVE_LIBRARY_SEM
  1672. .PEERDIR_POLICY=as_build_from
  1673. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  1674. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  1675. DISABLE(NEED_ADD_FAKE_SRC)
  1676. SRCS(build/scripts/_fake_src.cpp)
  1677. }
  1678. _SONAME=
  1679. _EXPORT_SCRIPT_SEM=
  1680. _CLEAN_TEXTREL=
  1681. macro _ADD_DYNLYB_SEM(Libname) {
  1682. .SEM=add_shared_library ${MODDIR} ${Libname} ${hide:TARGET} ${hide:AUTO_INPUT} && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && target_include_directories PRIVATE $_C__INCLUDE_OWNED && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE && ${VCS_INFO_SEM} $_EXPORT_SCRIPT_SEM
  1683. }
  1684. CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($CMAKE_TARGET_NAME) $CMAKE_TARGET_ARTEFACT_RENAME_RULES
  1685. macro CLEAN_TEXTREL() {
  1686. SET(_CLEAN_TEXTREL yes)
  1687. }
  1688. ### @usage: DLL_UNIT # internal
  1689. ###
  1690. ### Base module for all dynamically linked libraries as final artifacts.
  1691. ### Contains all general logic for such kind of modules. Supports versioning and export files.
  1692. ### Cannot participate in linking to programs, intended to be used as final artifact (packaged and deployed).
  1693. module DLL_UNIT: _LINK_UNIT {
  1694. .CMD=LINK_DYN_LIB
  1695. .SEM=CPP_DYN_LIBRARY_SEM
  1696. .NODE_TYPE=Library
  1697. .SYMLINK_POLICY=SO
  1698. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1699. .ALLOWED=WHOLE_ARCHIVE
  1700. .DEFAULT_NAME_GENERATOR=TwoDirNames
  1701. .ARGS_PARSER=DLL
  1702. DYNAMIC_LINK=yes
  1703. ALLOCATOR(FAKE)
  1704. SET(MODULE_TYPE DLL)
  1705. SET(MODULE_TAG DLL)
  1706. SET(MODULE_LANG CPP)
  1707. ADD_CLANG_TIDY()
  1708. when ($EXPORTS_FILE) {
  1709. _EXPORT_SCRIPT_SEM=&& use_export_script ${input:EXPORTS_FILE}
  1710. }
  1711. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1712. MODULE_SUFFIX=.dll
  1713. }
  1714. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  1715. MODULE_PREFIX=lib
  1716. MODULE_SUFFIX=.dylib
  1717. }
  1718. elsewhen ($TIDY_ENABLED == "yes") {
  1719. MODULE_PREFIX=
  1720. MODULE_SUFFIX=.tidyjson
  1721. }
  1722. otherwise {
  1723. MODULE_PREFIX=lib
  1724. MODULE_SUFFIX=.so
  1725. }
  1726. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  1727. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  1728. when ($MODULE_VERSION) {
  1729. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  1730. }
  1731. _SONAME=$SONAME$MODULE_VERSION
  1732. when ($LINUX == "yes") {
  1733. # '-z notext' is needed for linking mkl into shared libraries
  1734. when ($_CLEAN_TEXTREL != "yes") {
  1735. LDFLAGS += -Wl,-z,notext
  1736. }
  1737. }
  1738. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes") {
  1739. when ($_NO_FIX_ELF != "yes") {
  1740. LINK_DYN_LIB_FLAGS+=--fix-elf ${tool:"tools/fix_elf"}
  1741. }
  1742. }
  1743. when ($DARWIN == "yes") {
  1744. LDFLAGS += -undefined dynamic_lookup
  1745. }
  1746. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1747. PEERDIR+=library/cpp/testing/dump_clang_coverage
  1748. }
  1749. when ($IDE_MSVS == "yes") {
  1750. PEERDIR+=build/scripts/c_templates
  1751. }
  1752. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  1753. LINK_DYN_LIB_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  1754. }
  1755. }
  1756. # tag:r-specific
  1757. ### @usage: R_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  1758. ###
  1759. ### The external module for R language.
  1760. ### 1. major_ver and minor_ver must be integers.
  1761. ### 2. The resulting .so will have the prefix "lib".
  1762. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  1763. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  1764. module R_MODULE: DLL_UNIT {
  1765. .SEM=CPP_DYN_LIBRARY_SEM
  1766. when ($DARWIN == "yes") {
  1767. LDFLAGS+=-flat_namespace -dynamiclib
  1768. }
  1769. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1770. MODULE_PREFIX=lib
  1771. MODULE_SUFFIX=.dll
  1772. }
  1773. ADDINCL(contrib/libs/r-lang)
  1774. }
  1775. ### @usage: DYNAMIC_LIBRARY_FROM(Paths)
  1776. ###
  1777. ### Use specified libraries as sources of DLL
  1778. macro DYNAMIC_LIBRARY_FROM(Path...) {
  1779. PEERDIR($Path)
  1780. WHOLE_ARCHIVE($Path)
  1781. }
  1782. ### @usage: DLL(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  1783. ###
  1784. ### Dynamic library module definition.
  1785. ### 1. major_ver and minor_ver must be integers.
  1786. ### 2. EXPORTS allows you to explicitly specify the list of exported functions. This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files
  1787. ### 3. PREFIX allows you to change the prefix of the output file (default DLL has the prefix "lib").
  1788. ###
  1789. ### DLL cannot participate in linking to programs but can be used from Java or as final artifact (packaged and deployed).
  1790. module DLL: DLL_UNIT {
  1791. .SEM=CPP_DYN_LIBRARY_SEM
  1792. SET(MAKE_ONLY_SHARED_LIB yes)
  1793. when ($OS_WINDOWS) {
  1794. MODULE_SUFFIX=.dll
  1795. }
  1796. # TODO: Make it possible to use this syntax
  1797. # DEFAULT(DLL_FOR_DIR no)
  1798. ### FIXME: XXX
  1799. ###when ($DLL_FOR_DIR != "no") {
  1800. ### SRCDIR($DLL_FOR_DIR)
  1801. ### ADDINCL($DLL_FOR_DIR)
  1802. ###}
  1803. }
  1804. ### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool.
  1805. module DLL_TOOL: DLL {
  1806. .SEM=CPP_DYN_LIBRARY_SEM
  1807. # ymake resolves only program nodes as tools.
  1808. .NODE_TYPE=Program
  1809. }
  1810. ### @usage: SO_PROGRAM(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  1811. ###
  1812. ### Executable dynamic library module definition.
  1813. ### 1. major_ver and minor_ver must be integers.
  1814. ### 2. EXPORTS allows you to explicitly specify the list of exported functions. This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files
  1815. ### 3. PREFIX allows you to change the prefix of the output file.
  1816. module SO_PROGRAM: DLL {
  1817. .CMD=LINK_EXEC_DYN_LIB
  1818. SET(MODULE_TYPE PROGRAM)
  1819. MODULE_PREFIX=
  1820. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1821. MODULE_SUFFIX=.exe
  1822. }
  1823. otherwise {
  1824. MODULE_SUFFIX=
  1825. }
  1826. }
  1827. DLL_PROXY_CMD_MF=$GENERATE_MF && $COPY_CMD $AUTO_INPUT $TARGET
  1828. # tag:internal
  1829. ### @usage: DEV_DLL_PROXY() # internal
  1830. ###
  1831. ### The use of this module is strictly prohibited!!!
  1832. ### This is a temporary and project-specific solution.
  1833. module DEV_DLL_PROXY: _BARE_UNIT {
  1834. .NODE_TYPE=Library
  1835. .EXTS=.so .dll .dylib .mf
  1836. .CMD=DLL_PROXY_CMD_MF
  1837. DYNAMIC_LINK=yes
  1838. when ($OS_WINDOWS == "yes") {
  1839. MODULE_SUFFIX=.dll
  1840. }
  1841. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  1842. MODULE_PREFIX=lib
  1843. MODULE_SUFFIX=.dylib$MODULE_VERSION
  1844. }
  1845. otherwise {
  1846. MODULE_PREFIX=lib
  1847. MODULE_SUFFIX=.so$MODULE_VERSION
  1848. }
  1849. }
  1850. # tag:internal
  1851. ### @usage: DLL_PROXY() # internal
  1852. ###
  1853. ### The use of this module is strictly prohibited!!!
  1854. ### This is a temporary and project-specific solution.
  1855. module DLL_PROXY: DEV_DLL_PROXY {
  1856. .EXTS=.so .dylib .lib .mf
  1857. .PROXY=yes
  1858. .PEERDIR_POLICY=as_build_from
  1859. SET(PEERDIR_TAGS DLL __EMPTY__)
  1860. when ($OS_WINDOWS == "yes") {
  1861. MODULE_SUFFIX=.lib
  1862. }
  1863. }
  1864. # tag:internal
  1865. ### @usage: DYNAMIC_DEPS(Path...) # internal, temporary
  1866. ###
  1867. ### Enlist paths to all DYNAMIC_LIBRARY dependencies of the DYNAMIC_LIBRARY
  1868. ### This it needed to transfer their outputs through the library to PROGRAM
  1869. ### or dependent DLL/DYNAMIC_LIBRARY.
  1870. ###
  1871. ### Note: this is temporary solution until support of `super-global` variables come
  1872. ### which will enable transfer of some properties though final targets like DLLs.
  1873. macro DYNAMIC_DEPS(Path...) {
  1874. # PEERDIR as macro completely ignored in place where this macro applies
  1875. SET_APPEND(PEERDIR $Path)
  1876. }
  1877. # tag:internal
  1878. ### @usage: DYNAMIC_LIBRARY() # internal
  1879. ###
  1880. ### The use of this module is strictly prohibited except LGPL-related opensourcing
  1881. ### This provides linkable DLL module which brings its results to programs and tests
  1882. ### for seamless testing and packaging
  1883. multimodule DYNAMIC_LIBRARY {
  1884. module DLL_BIN: DLL {
  1885. .PROXY=yes
  1886. .IGNORED=PROVIDES
  1887. SET(MODULE_TAG DLL)
  1888. }
  1889. module DLL_LIB: _DLL_COMPATIBLE_LIBRARY {
  1890. .CMD=TOUCH_UNIT_MF
  1891. .PEERDIRSELF=DLL_BIN
  1892. .IGNORED=SRCS PEERDIR RUN_PROGRAM PYTHON DYNAMIC_LIBRARY_FROM GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2 USE_PYTHON3
  1893. .ALLOWED=DYNAMIC_DEPS
  1894. SET(PEERDIR_TAGS DLL_LIB __EMPTY__)
  1895. _BARE_MODULE()
  1896. DYNAMIC_LINK=yes
  1897. MODULE_SUFFIX=.pkg.fake
  1898. PEERDIR+=build/platform/local_so
  1899. # disable credits generation for static library
  1900. SET(CREDITS_FLAGS)
  1901. }
  1902. }
  1903. ### @usage: GLOBAL_SRCS(filenames...)
  1904. ###
  1905. ### Make all source files listed as GLOBAL.
  1906. ### Call to GLOBAL_SRCS macro is equivalent to call to SRCS macro when each source file is marked with GLOBAL keyword.
  1907. ### Arcadia root relative or project dir relative paths are supported for filenames arguments. GLOBAL keyword is not
  1908. ### recognized for GLOBAL_SRCS in contrast to SRCS macro.
  1909. ###
  1910. ### @example:
  1911. ### Consider the file to ya.make:
  1912. ###
  1913. ### LIBRARY()
  1914. ### GLOBAL_SRCS(foo.cpp bar.cpp)
  1915. ### END()
  1916. ###
  1917. ### @see: [SRCS()](#macro_SRCS)
  1918. macro GLOBAL_SRCS(Files...) {
  1919. SRCS(${pre=GLOBAL :Files})
  1920. }
  1921. ### @usage: ALL_SRCS([GLOBAL] filenames...)
  1922. ###
  1923. ### Make all source files listed as GLOBAL or not depending on the keyword GLOBAL
  1924. ### Call to ALL_SRCS macro is equivalent to call to GLOBAL_SRCS macro when GLOBAL keyword is specified
  1925. ### as the first argument and is equivalent to call to SRCS macro otherwise.
  1926. ###
  1927. ### @example:
  1928. ###
  1929. ### LIBRARY()
  1930. ### SET(MAKE_IT_GLOBAL GLOBAL)
  1931. ### ALL_SRCS(${MAKE_IT_GLOBAL} foo.cpp bar.cpp)
  1932. ### END()
  1933. ###
  1934. ### @see: [GLOBAL_SRCS()](#macro_GLOBAL_SRCS), [SRCS()](#macro_SRCS)
  1935. macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
  1936. SRCS(${pre=$GLOBAL :Files})
  1937. }
  1938. ### @usage: _DLL_COMPATIBLE_LIBRARY # internal
  1939. ###
  1940. ### Base module to place DLLs into multimodules back to back with libraries.
  1941. ### In order to function properly all modules in multimodule shall have the
  1942. ### same set of arguments. So this module is just library that accepts but
  1943. ### ignores all DLL arguments.
  1944. module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
  1945. .DEFAULT_NAME_GENERATOR=TwoDirNames
  1946. .ARGS_PARSER=DLL
  1947. }
  1948. # as SRCS in packages use macro BUNDLE_SRCS!
  1949. PACKED_PACKAGE_ARGS=
  1950. PACKED_PACKAGE_EXT=
  1951. ### @usage: PACK(archive_type)
  1952. ###
  1953. ### When placed inside the PACKAGE module, packs the build results tree to the archive with specified extension. Currently supported extensions are `tar` and `tar.gz`
  1954. ###
  1955. ### Is not allowed other module types than PACKAGE().
  1956. ###
  1957. ### @see: [PACKAGE()](#module_PACKAGE)
  1958. macro PACK(Ext) {
  1959. SET(PACKED_PACKAGE_EXT $Ext)
  1960. }
  1961. PACKAGE_STRICT_VALUE=
  1962. macro PACKAGE_STRICT() {
  1963. SET(PACKAGE_STRICT_VALUE yes)
  1964. }
  1965. ### @usage: PACKAGE(name)
  1966. ###
  1967. ### Module collects what is described directly inside it, builds and collects all its transitively available PEERDIRs.
  1968. ### As a result, build directory of the project gets the structure of the accessible part of Arcadia, where the build result of each PEERDIR is placed to relevant Arcadia subpath.
  1969. ### The data can be optionally packed if macro PACK() is used.
  1970. ###
  1971. ### Is only used together with the macros FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a PACKAGE.
  1972. ###
  1973. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  1974. ###
  1975. ### @see: [PACK()](#macro_PACK)
  1976. multimodule PACKAGE {
  1977. module PACKAGE_FINAL: _BASE_UNIT {
  1978. .CMD=TOUCH_PACKAGE_MF
  1979. .ALIASES=SRCS=FILES
  1980. .ALLOWED=PACK
  1981. .PEERDIRSELF=PACKAGE_UNION
  1982. .USE_PEERS_LATE_OUTS=yes
  1983. .PEERDIR_POLICY=as_build_from
  1984. .FINAL_TARGET=yes
  1985. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2 PY3 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM PACKAGE_UNION)
  1986. SET(MODULE_SUFFIX .final.pkg.fake)
  1987. SET(DONT_RESOLVE_INCLUDES yes)
  1988. NO_PLATFORM()
  1989. when ($PACKED_PACKAGE_EXT) {
  1990. PACKED_PACKAGE_ARGS+=--dest-arch ${output;pre=$MODULE_PREFIX;suf=.$PACKED_PACKAGE_EXT:REALPRJNAME}
  1991. }
  1992. SET(NEED_PLATFORM_PEERDIRS no)
  1993. }
  1994. module PACKAGE_UNION: UNION {
  1995. .CMD=UNION_CMD
  1996. .FINAL_TARGET=no
  1997. .ALLOWED=PACK
  1998. .IGNORED=VCS_INFO_FILE
  1999. SET(MODULE_SUFFIX .pkg.fake)
  2000. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2 PY3 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM PACKAGE_UNION)
  2001. DISABLE(START_TARGET)
  2002. }
  2003. }
  2004. TOUCH_GROUP=$TOUCH_PACKAGE ${kv;hide:"p CI"}
  2005. ### @usage: CI_GROUP()
  2006. ###
  2007. ### Module collects what is described directly inside it transitively by PEERDIRs.
  2008. ### No particular layout of built artifacts is implied. This module is needed primarily for CI dependency analysis and may not trigger builds at all.
  2009. ###
  2010. ### Is only used together with the macro PEERDIR() and FILES(). Don't use SRCS inside CI_GROUP().
  2011. module CI_GROUP: _BARE_UNIT {
  2012. .CMD=TOUCH_GROUP
  2013. .PEERDIR_POLICY=as_build_from
  2014. .FINAL_TARGET=yes
  2015. .RESTRICTED=SRCS
  2016. .USE_PEERS_LATE_OUTS=yes
  2017. MODULE_SUFFIX=.ci.pkg.fake
  2018. PEERDIR_TAGS=CPP_PROTO PY3 PY3_NATIVE PY3_BIN PY3TEST_PROGRAM YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE DLL
  2019. }
  2020. # tag:generic tag:internal
  2021. TOUCH_UNIT_MF=$TOUCH_UNIT && $GENERATE_MF
  2022. ### @usage: UNION(name)
  2023. ###
  2024. ### Collection of PEERDIR dependencies, files and artifacts.
  2025. ### UNION doesn't build its peers, just provides those to modules depending on it.
  2026. ### When specified in DEPENDS() macro the UNION is transitively closed, building all its peers and providing those by own paths (without adding this module path like PACKAGE does).
  2027. ###
  2028. ### Is only used together with the macros like FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a UNION.
  2029. ###
  2030. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2031. module UNION: _BASE_UNIT {
  2032. .CMD=UNION_CMD_MF
  2033. .FINAL_TARGET=no
  2034. .ALIASES=SRCS=FILES
  2035. .ALLOWED=EXPLICIT_OUTPUTS
  2036. .IGNORED=VCS_INFO_FILE
  2037. NO_PLATFORM()
  2038. SET(MODULE_SUFFIX .pkg.fake)
  2039. SET(DONT_RESOLVE_INCLUDES yes)
  2040. SET(NEED_PLATFORM_PEERDIRS no)
  2041. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN DLL PACKAGE_UNION
  2042. UNION_OUTS=${hide;late_out:AUTO_INPUT}
  2043. when ($_UNION_EXPLICIT_OUTPUTS) {
  2044. UNION_OUTS=$_EXPAND_INS_OUTS($_UNION_EXPLICIT_OUTPUTS)
  2045. }
  2046. }
  2047. # tag:internal
  2048. ### @usage: _SET_FIRST_VALUE(name args...) # internal
  2049. ###
  2050. ### This macro sets the value of `name` variable to the value of next argument
  2051. macro _SET_FIRST_VALUE(NAME, VALUE, OTHER...) {
  2052. SET($NAME $VALUE)
  2053. }
  2054. # tag:internal
  2055. ### @usage: _SRCS_NO_GLOBAL(files...) # internal
  2056. ###
  2057. ### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
  2058. ### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
  2059. ### Note: this macro changes order of source files.
  2060. macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
  2061. SRCS($GLOBAL $FILES)
  2062. }
  2063. @import "${CONF_ROOT}/conf/java.conf"
  2064. @import "${CONF_ROOT}/conf/python.conf"
  2065. TEST_CWD_VALUE=
  2066. ### @usage: TEST_CWD(path)
  2067. ###
  2068. ### Defines working directory for test runs. Often used in conjunction with DATA() macro.
  2069. ### Is only used inside of the TEST modules.
  2070. ###
  2071. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  2072. macro TEST_CWD(Arg) {
  2073. SET(TEST_CWD_VALUE $Arg)
  2074. }
  2075. # tag:allocator
  2076. ### @usage: ALLOCATOR(Alloc) # Default: LF
  2077. ###
  2078. ### Set memory allocator implementation for the PROGRAM()/DLL() module.
  2079. ### This may only be specified for programs and dlls, use in other modules leads to configuration errors.
  2080. ###
  2081. ### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU", "PROFILED_HU", "THREAD_PROFILED_HU".
  2082. ### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc)
  2083. ### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make)
  2084. ### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make)
  2085. ### - YT - The YTAlloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/ytalloc/impl/ya.make)
  2086. ### - J - The JEMalloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/jemalloc)
  2087. ### - B - The balloc allocator named Pyotr Popov and Anton Samokhvalov
  2088. ### - Discussion: https://ironpeter.at.yandex-team.ru/replies.xml?item_no=126
  2089. ### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc
  2090. ### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved)
  2091. ### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM)
  2092. ### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc)
  2093. ### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc)
  2094. ### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc)
  2095. ### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless)
  2096. ### - SYSTEM - Use target system allocator
  2097. ### - FAKE - Don't link with any allocator
  2098. ### - HU - Huge page allocator by @gulin.
  2099. ### - PROFILED_HU - patched HU. It is a bit slower but has metrics of memory consumption.
  2100. ### - THREAD_PROFILED_HU - patched (special for market) HU. It is a bit slower but has metrics of memory consumption.
  2101. ###
  2102. ### More about allocators in Arcadia: https://wiki.yandex-team.ru/arcadia/allocators/
  2103. macro ALLOCATOR(Alloc) {
  2104. SET(ALLOCATOR $Alloc)
  2105. when ($ALLOCATOR in [ "LF", "LF_YT", "LF_DBG", "YT", "YT_TCMALLOC", "YT_TCMALLOC_256K", "J", "B", "BM", "C", "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU", "PROFILED_HU", "THREAD_PROFILED_HU" ]) {
  2106. }
  2107. otherwise {
  2108. PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR
  2109. }
  2110. }
  2111. when ($MIC_ARCH == "yes") {
  2112. CFLAGS+=-mmic
  2113. LDFLAGS+=-mmic
  2114. }
  2115. when ($USE_OPENMP == "yes") {
  2116. PEERDIR+=contrib/libs/openmp
  2117. }
  2118. when ($STRIP == "yes" && $NO_STRIP != "yes") {
  2119. STRIP_FLAG=$LD_STRIP_FLAG
  2120. DWARF_COMMAND=
  2121. GO_LINK_FLAGS_VALUE+=-s
  2122. }
  2123. when ($NO_LINKER_DCE != "yes") {
  2124. DCE_FLAG=$LD_DCE_FLAG
  2125. }
  2126. when ($BT_MINSIZEREL == "yes" || $LINKER_ICF == "yes") {
  2127. ICF_FLAG=$LD_ICF_FLAG
  2128. }
  2129. OBJCOPY_TOOL=$OBJCOPY_TOOL_VENDOR
  2130. OBJDUMP_TOOL=$OBJDUMP_TOOL_VENDOR
  2131. STRIP_TOOL=$STRIP_TOOL_VENDOR
  2132. NEED_BINUTILS_PEERDIR=
  2133. BINUTILS_USED=
  2134. when (!$OBJCOPY_TOOL_VENDOR) {
  2135. OBJCOPY_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objcopy
  2136. NEED_BINUTILS_PEERDIR=yes
  2137. }
  2138. when (!$OBJDUMP_TOOL_VENDOR) {
  2139. OBJDUMP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objdump
  2140. NEED_BINUTILS_PEERDIR=yes
  2141. }
  2142. when (!$STRIP_TOOL_VENDOR) {
  2143. STRIP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/strip
  2144. NEED_BINUTILS_PEERDIR=yes
  2145. }
  2146. SPLIT_DWARF_VALUE=no
  2147. NO_SPLIT_DWARF=no
  2148. when ($OS_DARWIN || $OS_IOS || $OS_IOSSIM) {
  2149. SPLIT_DWARF_VALUE=yes
  2150. }
  2151. when ($STRIP_DEBUG_INFO) {
  2152. SPLIT_DWARF_VALUE=yes
  2153. NO_SPLIT_DWARF=no
  2154. }
  2155. ### @usage: SPLIT_DWARF()
  2156. ###
  2157. ### Emit debug info for the PROGRAM/DLL as a separate file <module_name>.debug.
  2158. ### NB: It does not help you to save process RSS but can add problems (see e.g. BEGEMOT-2147).
  2159. macro SPLIT_DWARF() {
  2160. SET(SPLIT_DWARF_VALUE yes)
  2161. }
  2162. ### @usage: NO_SPLIT_DWARF()
  2163. ###
  2164. ### Do NOT emit debug info for the PROGRAM/DLL as a separate file.
  2165. ### On macOS this also means do NOT generate dSym files (faster linkage)
  2166. macro NO_SPLIT_DWARF() {
  2167. SET(SPLIT_DWARF_VALUE no)
  2168. }
  2169. SPLIT_DWARF_OUTPUT=${output;tobindir;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
  2170. when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
  2171. DWARF_COMMAND+= \
  2172. $OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
  2173. $STRIP_TOOL --strip-debug $TARGET && \
  2174. $OBJCOPY_TOOL --remove-section=.gnu_debuglink --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
  2175. BINUTILS_USED=yes
  2176. }
  2177. ### @usage: EXTRALIBS_STATIC(Libs...)
  2178. ###
  2179. ### Add the specified external static libraries to the program link
  2180. macro EXTRALIBS_STATIC(Args...) {
  2181. LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic)
  2182. }
  2183. ### @usage ADD_COMPILABLE_TRANSLATE(Dict Name Options...)
  2184. ###
  2185. ### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library
  2186. macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) {
  2187. __translatename_lower=${tolower:Name}
  2188. __translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp
  2189. RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict})
  2190. }
  2191. ### @usage ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...)
  2192. ###
  2193. ### Generate transliteration dictionary code
  2194. ### This will emit both translit, untranslit and ngrams table codes those will be than further compiled into library
  2195. macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) {
  2196. __translitname_lower=${tolower:Name}
  2197. __translit_table=${BINDIR}/translit_trie_${__translitname_lower}.cpp
  2198. __untranslit_table=${BINDIR}/untranslit_trie_${__translitname_lower}.cpp
  2199. __ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp
  2200. __gentrie_dir=dict/tools/make_untranslit_trie
  2201. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table})
  2202. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table})
  2203. RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table})
  2204. }
  2205. macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], INDUCED_DEPS[], OUTPUT_INCLUDES_INP[]) {
  2206. .CMD=$COPY_CMD ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} ${output_include;hide:OUTPUT_INCLUDES} ${output_include;from_input;hide:OUTPUT_INCLUDES_INP} $INDUCED_DEPS ${kv;hide:"p CP"} ${kv;hide:"pc light-cyan"}
  2207. .SEM=copy_file ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST}
  2208. }
  2209. ### @usage: COPY_FILE(File Destination [AUTO] [OUTPUT_INCLUDES Deps...])
  2210. ###
  2211. ### Copy file to build root. It is possible to change both location and the name.
  2212. ###
  2213. ### Parameters:
  2214. ### - File - Source file name.
  2215. ### - Destination - Output file name.
  2216. ### - AUTO - Consider copied file for further processing automatically.
  2217. ### - OUTPUT_INCLUDES output_includes... - Output file dependencies.
  2218. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  2219. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type)
  2220. ### and set of dependencies
  2221. ###
  2222. ### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly
  2223. ### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing.
  2224. macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  2225. .CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  2226. .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination)
  2227. }
  2228. ### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...])
  2229. ###
  2230. ### Copy file to build root the same way as it is done for COPY_FILE, but also
  2231. ### propagates the context of the source file.
  2232. macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  2233. .CMD=$_COPY_FILE_IMPL($FILE $AUTO $DEST OUTPUT_INCLUDES_INP $FILE OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  2234. }
  2235. ### This is to join $ALL_RES_ and $EXT
  2236. macro _ARF_HELPER(Args...) {
  2237. RESOURCE_FILES($Args)
  2238. }
  2239. ### @usage ALL_RESOURCE_FILES(Ext [PREFIX {prefix}] [STRIP {strip}] Dirs...)
  2240. ###
  2241. ### This macro collects all files with extension `Ext` and
  2242. ### Passes them to `RESOURCE_FILES` macro as relative to current directory
  2243. ###
  2244. ### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
  2245. ###
  2246. ### Note: This macro can be used multiple times per ya.make, but only once for each Ext value
  2247. ### Note: Wildcards are not allowed neither as Ext nor in Dirs
  2248. macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
  2249. _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS})
  2250. _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${pre=$ALL_RES_:EXT})
  2251. }
  2252. macro _BUNDLE_TARGET(Target, Destination) {
  2253. .CMD=$MOVE_FILE ${result:Target} ${output;noauto:Destination} ${kv;hide:"p BN"} ${kv;hide:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
  2254. }
  2255. ### @usage: TIMEOUT(TIMEOUT)
  2256. ###
  2257. ### Sets a timeout on test execution
  2258. ###
  2259. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2260. macro TIMEOUT(Time) {
  2261. SET(TEST_TIMEOUT $Time)
  2262. }
  2263. SBR_UID_EXT=""
  2264. # tag:test
  2265. ### @usage: VALIDATE_DATA_RESTART(ext)
  2266. ###
  2267. ### Change uid for resource validation tests. May be useful when sandbox resource ttl is changed, but test status is cached in CI.
  2268. ### You can change ext to change test's uid. For example VALIDATE_DATA_RESTART(X), where is X is current revision.
  2269. macro VALIDATE_DATA_RESTART(Ext) {
  2270. SET(SBR_UID_EXT $Ext)
  2271. }
  2272. # tag:test
  2273. TEST_FORK_MODE=none
  2274. TEST_PARTITION=SEQUENTIAL
  2275. # tag:test
  2276. ### @usage: FORK_TESTS()
  2277. ###
  2278. ### Splits a test run on chunks by test classes.
  2279. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  2280. ###
  2281. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  2282. ###
  2283. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2284. macro FORK_TESTS(MODE...) {
  2285. SET(TEST_FORK_MODE tests)
  2286. SET(TEST_PARTITION $MODE)
  2287. }
  2288. # tag:test
  2289. ### @usage: FORK_SUBTESTS()
  2290. ###
  2291. ### Splits the test run in chunks on subtests.
  2292. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  2293. ###
  2294. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  2295. ###
  2296. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2297. macro FORK_SUBTESTS(MODE...) {
  2298. SET(TEST_FORK_MODE subtests)
  2299. SET(TEST_PARTITION $MODE)
  2300. }
  2301. # tag:test
  2302. ### @usage: SPLIT_FACTOR(x)
  2303. ###
  2304. ### Sets the number of chunks for parallel run tests when used in test module with FORK_TESTS() or FORK_SUBTESTS().
  2305. ### If none of those is specified this macro implies FORK_TESTS().
  2306. ###
  2307. ### Supports C++ ut and PyTest.
  2308. ###
  2309. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2310. macro SPLIT_FACTOR(Factor) {
  2311. SET(TEST_SPLIT_FACTOR $Factor)
  2312. }
  2313. # tag:test
  2314. FORK_TEST_FILES_MODE=
  2315. ### @usage: FORK_TEST_FILES()
  2316. ###
  2317. ### Only for PY2TEST and PY3TEST: splits a file executable with the tests on chunks in the files listed in TEST_SRCS
  2318. ### Compatible with FORK_(SUB)TESTS.
  2319. ###
  2320. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2321. macro FORK_TEST_FILES() {
  2322. SET(FORK_TEST_FILES_MODE on)
  2323. }
  2324. # tag:test
  2325. TEST_SIZE_NAME=SMALL
  2326. ### @usage: SIZE(SMALL/MEDIUM/LARGE)
  2327. ###
  2328. ### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list.
  2329. ### See documentation on test system for more details.
  2330. ###
  2331. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2332. macro SIZE(Type) {
  2333. SET(TEST_SIZE_NAME $Type)
  2334. }
  2335. ### @usage: JOIN_SRCS(Out Src...)
  2336. ###
  2337. ### Join set of sources into single file named Out and send it for further processing.
  2338. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  2339. ### You should specify file name with the extension as Out. Further processing will be done according this extension.
  2340. macro JOIN_SRCS(Out, Src...) {
  2341. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  2342. .SEM=target_joined_source $Out ${input:Src} ${output;hide;suf=.o:Out} ${input;hide:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"}
  2343. _CONDITIONAL_SRCS($TIDY_VALUE $Src)
  2344. }
  2345. ### @usage: JOIN_SRCS_GLOBAL(Out Src...)
  2346. ###
  2347. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  2348. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  2349. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  2350. macro JOIN_SRCS_GLOBAL(Out, Src...) {
  2351. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output;noauto:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  2352. SRCS(GLOBAL $Out)
  2353. }
  2354. ### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...)
  2355. ###
  2356. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  2357. ### This macro places all files into single file, so will work with any sources.
  2358. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  2359. macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) {
  2360. .CMD=$FS_TOOLS cat ${output;noauto:Out} --ya-start-command-file ${input:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  2361. SRCS(GLOBAL $Out)
  2362. }
  2363. # tag:cpu
  2364. PIC_CFLAGS=
  2365. SSE2_CFLAGS=
  2366. SSE3_CFLAGS=
  2367. SSSE3_CFLAGS=
  2368. SSE41_CFLAGS=
  2369. SSE42_CFLAGS=
  2370. POPCNT_CFLAGS=
  2371. PCLMUL_CFLAGS=
  2372. CX16_FLAGS=
  2373. AVX_CFLAGS=
  2374. AVX2_CFLAGS=
  2375. AVX512_CFLAGS=
  2376. AMX_CFLAGS=
  2377. # tag:cpu
  2378. SSE_DEFINES=
  2379. SSE_CFLAGS=
  2380. SSE4_DEFINES=
  2381. SSE4_CFLAGS=
  2382. XOP_CFLAGS=
  2383. NO_LTO_CFLAGS=
  2384. # tag:cpu
  2385. when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") {
  2386. when ($CLANG || $CLANG_CL || $GCC) {
  2387. PIC_CFLAGS=-fPIC
  2388. SSE2_CFLAGS=-msse2
  2389. SSE3_CFLAGS=-msse3
  2390. SSSE3_CFLAGS=-mssse3
  2391. SSE41_CFLAGS=-msse4.1
  2392. SSE42_CFLAGS=-msse4.2
  2393. XOP_CFLAGS=-mxop
  2394. POPCNT_CFLAGS=-mpopcnt
  2395. PCLMUL_CFLAGS=-mpclmul
  2396. AVX_CFLAGS=-mavx
  2397. # On Intel BMI1, BMI2 and FMA3 instruction sets come together with AVX-2 extension starting with Broadwell / Haswell.
  2398. # See:
  2399. # https://en.wikipedia.org/wiki/FMA_instruction_set
  2400. # https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set
  2401. #
  2402. # AMD implemented FMA3 in Piledriver architecture over AVX (that is, prior to AVX-2 which was introduced in Zen).
  2403. # BMI2 implementation was released by AMD along with AVX-2 support.
  2404. # See:
  2405. # https://en.wikipedia.org/wiki/Template:AMD_x86_CPU_features
  2406. #
  2407. # Due to the above, it looks safe to enable all three extensions whenever AVX-2 is enabled.
  2408. AVX2_CFLAGS=-mavx2 -mfma -mbmi -mbmi2
  2409. # All Intel CPUS with AVX-512 have these instructions except for the Knights Landing / Knights Mill
  2410. # (these are Xeon Phi)
  2411. # See:
  2412. # https://en.wikichip.org/wiki/x86/avx-512
  2413. AVX512_CFLAGS=-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
  2414. # AMX stands Advanced Matrix Extension supported by modern Intel architectures
  2415. # See:
  2416. # https://en.wikipedia.org/wiki/Advanced_Matrix_Extensions
  2417. # https://en.wikichip.org/wiki/x86/amx
  2418. AMX_CFLAGS=-mamx-tile -mamx-int8 ${AVX512_CFLAGS}
  2419. when ($ARCH_X86_64 && $OS_ANDROID != "yes") {
  2420. CX16_FLAGS=-mcx16
  2421. }
  2422. SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1
  2423. SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1
  2424. }
  2425. elsewhen ($MSVC) {
  2426. SSE2_CFLAGS=/D__SSE2__=1
  2427. SSE3_CFLAGS=/D__SSE3__=1
  2428. SSSE3_CFLAGS=/D__SSSE3__=1
  2429. SSE41_CFLAGS=/D__SSE4_1__=1
  2430. SSE42_CFLAGS=/D__SSE4_2__=1
  2431. POPCNT_CFLAGS=/D__POPCNT__=1
  2432. PCLMUL_CFLAGS=/D__PCLMUL__=1
  2433. AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1
  2434. AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1
  2435. AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1
  2436. SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1
  2437. SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1
  2438. }
  2439. SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS
  2440. SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS
  2441. when ($ARCH_I386 && $OS_ANDROID == "yes") {
  2442. USE_SSE4=no
  2443. }
  2444. }
  2445. otherwise {
  2446. USE_SSE4=no
  2447. CPU_CHECK=no
  2448. }
  2449. # tag:cpu
  2450. when ($NOSSE == "yes") {
  2451. USE_SSE4=no
  2452. }
  2453. # tag:cpu
  2454. ### @usage: NO_SSE4()
  2455. ###
  2456. ### Compile module without SSE4
  2457. macro NO_SSE4() {
  2458. SET(USE_SSE4 no)
  2459. }
  2460. # tag:cpu
  2461. ### @usage: NO_CPU_CHECK()
  2462. ###
  2463. ### Compile module without startup CPU features check
  2464. macro NO_CPU_CHECK() {
  2465. SET(CPU_CHECK no)
  2466. }
  2467. ### @usage: ADDINCLSELF()
  2468. ###
  2469. ### The macro adds the -I<project source path> flag to the source compilation flags of the current project.
  2470. macro ADDINCLSELF(FOR="") {
  2471. when($FOR) {
  2472. ADDINCL+=FOR $FOR ${MODDIR}
  2473. }
  2474. otherwise {
  2475. ADDINCL+=${MODDIR}
  2476. }
  2477. }
  2478. COMPILE_OUT_SUFFIX=
  2479. _COMPILE_OUTPUTS=${output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}:SRC}
  2480. _COMPILE_TIME_TRACE_OUTPUTS=${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}.time_trace.json:SRC}
  2481. macro SET_COMPILE_OUTPUTS_MODIFIERS(NOREL?";norel":"") {
  2482. SET(_COMPILE_OUTPUTS \${output;suf=\${OBJECT_SUF}$NOREL:SRC})
  2483. SET(_COMPILE_TIME_TRACE_OUTPUTS \${output;noauto;suf=\${OBJECT_SUF}.time_trace.json$NOREL:SRC})
  2484. }
  2485. # tag:internal
  2486. ### @usage: _ADD_EXTRA_FLAGS_IMPL([GENERATE] Args...) # internal
  2487. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " before $Args when GENERATE
  2488. ### is specified in the list of actual arguments
  2489. macro _ADD_EXTRA_FLAGS_IMPL(GENERATE?" && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS ":"", Args...) {
  2490. .SEM=$GENERATE $Args
  2491. }
  2492. # tag:internal
  2493. ### @usage: _ADD_EXTRA_FLAGS([GENERATE] Args...) # internal
  2494. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " if Args is not empty
  2495. macro _ADD_EXTRA_FLAGS(COMPILE_OUT_SUFFIX="", Args...) {
  2496. .SEM=$_ADD_EXTRA_FLAGS_IMPL(${pre=GENERATE :Args})
  2497. }
  2498. _EMPTY_CMD=
  2499. # tag:src-processing tag:internal
  2500. ### @usage: _SRC(Ext Src Flags) # internal
  2501. ###
  2502. ### Basic building block of extension-based command dispatching
  2503. ### To enable specific extension processing define _SRC() macro with fixed first argument (Ext).
  2504. ### Internal logic will apply this macro to all files with this Ext listed in SRC/SRCS macros or outputs
  2505. ### of other commands (except ones marked as noauto)
  2506. macro _SRC(EXT, SRC, SRCFLAGS...) {
  2507. # Generic macro definition for _SRC (just a placeholder, it does nothing)
  2508. }
  2509. # tag:src-processing
  2510. macro _SRC("swg", SRC, SRCFLAGS...) {
  2511. .CMD=${_SWIG_CMD}
  2512. .PEERDIR=${_SWIG_PEERDIR}
  2513. .SEM=conan_require_tool swig/4.0.2 && conan_import '"bin, *swig* -> ./bin"' ${input;hide:SRC} ${_SWIG_SEM_TO_MODULE_LINK}
  2514. }
  2515. RODATA_SYMBOL_PREFIX=
  2516. when ($DARWIN == "yes" || $IOS == "yes" || ($WINDOWS == "yes" && $ARCH_TYPE_32 == "yes")) {
  2517. RODATA_SYMBOL_PREFIX=_
  2518. }
  2519. RODATA_ELF_FLAGS=
  2520. when($LINUX == "yes" || $ANDROID == "yes") {
  2521. RODATA_ELF_FLAGS=--elf
  2522. }
  2523. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2asm.py"} $RODATA_ELF_FLAGS ${RODATA_SYMBOL_PREFIX}${noext;nopath:SRC} ${input:SRC} ${tmp;suf=.asm:SRC} ${hide:OBJECT_SUF} && $_SRC_yasm_helper(${tmp;suf=.asm:SRC})
  2524. when (($ARCH_AARCH64 || $ARCH_ARM || $ARCH_PPC64LE || $ARCH_RISCV32) == "yes") {
  2525. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2cpp.py"} ${noext;nopath:SRC} ${input:SRC} ${output;suf=.cpp:SRC}
  2526. }
  2527. # tag:src-processing
  2528. macro _SRC("rodata", SRC, SRCFLAGS...) {
  2529. .CMD=$RODATA_COMPILE ${hide;kv:"p RD"} ${hide;kv:"pc light-green"}
  2530. .SEM=target_rodata_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} ${input;hide:"build/scripts/rodata2cpp.py"}
  2531. }
  2532. macro _SRS_S_ASM(SRC, SRCFLAGS...) {
  2533. .CMD=$C_COMPILER $C_FLAGS_PLATFORM $CFLAGS $SFLAGS $SRCFLAGS -c -o ${output:SRC.o} ${input:SRC} $TOOLCHAIN_ENV ${pre=-I:_C__INCLUDE}
  2534. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS) && add_language ASM
  2535. }
  2536. # tag:src-processing
  2537. macro _SRC("S", SRC, SRCFLAGS...) {
  2538. .CMD=$_SRS_S_ASM($SRC, $SRCFLAGS)
  2539. .SEM=$_SRS_S_ASM($SRC, $SRCFLAGS)
  2540. }
  2541. # tag:src-processing
  2542. macro _SRC("s", SRC, SRCFLAGS...) {
  2543. .CMD=$_SRS_S_ASM($SRC, $SRCFLAGS)
  2544. .SEM=$_SRS_S_ASM($SRC, $SRCFLAGS)
  2545. }
  2546. # tag:src-processing
  2547. macro _SRC("s79", SRC, SRCFLAGS...) {
  2548. .CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp)
  2549. }
  2550. # tag:src-processing
  2551. macro _SRC("mm", SRC, SRCFLAGS...) {
  2552. .CMD=$C_COMPILER $C_FLAGS_PLATFORM -x objective-c++ -fobjc-arc -fobjc-abi-version=2 -c -o ${output:SRC.o} ${input:SRC} $CXXFLAGS ${pre=-I:_C__INCLUDE} ${SRCFLAGS} ${kv;hide:"p CC"} ${kv;hide:"pc light-green"} $TOOLCHAIN_ENV
  2553. }
  2554. # tag:src-processing
  2555. macro _SRC("fml", SRC, SRCFLAGS...) {
  2556. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output:SRC.inc} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  2557. }
  2558. # tag:src-processing
  2559. macro _SRC("fml2", SRC, SRCFLAGS...) {
  2560. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output;nopath;noext:SRC.fml.inc} -2 -O ${output;nopath;noext:SRC.fml.cpp} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  2561. }
  2562. # tag:src-processing
  2563. macro _SRC("fml3", SRC, SRCFLAGS...) {
  2564. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output;nopath;noext:SRC.fml.inc} -3 -O ${output;nopath;noext:SRC.fml.cpp} -L ${input;nopath;noext:SRC.list} -P ${nopath;noext:SRC} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  2565. }
  2566. # tag:src-processing
  2567. macro _SRC("sfdl", SRC, SRCFLAGS...) {
  2568. .CMD=$CXX_COMPILER $C_FLAGS_PLATFORM $CXXFLAGS $SFDL_FLAG ${SRCFLAGS} ${input:SRC} && ${tool:"tools/calcstaticopt"} -i ${tmp:SRC.tmp} -a $ARCADIA_ROOT ${output;stdout;nopath;noext;defext=.inc:SRC} ${kv;hide:"p SF"} ${kv;hide:"pc yellow"} $TOOLCHAIN_ENV
  2569. }
  2570. macro _XS_SRCS(SRC, TYPEMAPS[], SRCFLAGS...) {
  2571. .CMD=$PERL_LD_LIBRARY_PATH $PERL $PERL_INCLUDE ${suf=/ExtUtils/xsubpp:PERL_PRIVLIB} -typemap ${suf=/ExtUtils/typemap:PERL_PRIVLIB} $PERLSUFFIX $XSUBPPFLAGS ${pre=-typemap :TYPEMAPS} ${input;hide:TYPEMAPS} ${SRCFLAGS} ${input:SRC} ${PERLOUTPUT} ${kv;hide:"p XS"} ${kv;hide:"pc yellow"}
  2572. }
  2573. # tag:src-processing
  2574. macro _SRC("xs", SRC, SRCFLAGS...) {
  2575. .CMD=$_XS_SRCS($SRC TYPEMAPS $_XSTYPEMAPS $SRCFLAGS)
  2576. }
  2577. # tag:src-processing
  2578. macro _SRC("gperf", SRC, SRCFLAGS...) {
  2579. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/gperf"} $GP_FLAGS ${SRCFLAGS} ${pre=-Nin_;suf=_set;nopath;noallext:SRC} ${input:SRC} ${output;stdout;nopath;noext;defext=.gperf.cpp:SRC} ${kv;hide:"p GP"} ${kv;hide:"pc yellow"}
  2580. }
  2581. # tag:src-processing
  2582. macro _SRC("rl", SRC, SRCFLAGS...) {
  2583. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/ragel"} $RAGEL_FLAGS ${SRCFLAGS} -o ${tmp:SRC.tmp} ${input:SRC} && $RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/rlgen-cd"} $RLGEN_FLAGS -o ${output;nopath;noext;defext=.rl5.cpp:SRC} ${tmp:SRC.tmp} ${kv;hide:"p R5"} ${kv;hide:"pc yellow"}
  2584. }
  2585. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  2586. .CMD=$YMAKE_PYTHON ${input:"library/cpp/xml/parslib/xsyn2ragel.py"} ${input:SRC} ${input:"library/cpp/xml/parslib/xmlpars.xh"} dontuse ${output;stdout;suf=.h.rl5:SRC} ${kv;hide:"p XN"} ${kv;hide:"pc yellow"}
  2587. }
  2588. # tag:src-processing
  2589. macro _SRC("rl5", SRC, SRCFLAGS...) {
  2590. .CMD=$_SRC(rl $SRC $SRCFLAGS)
  2591. }
  2592. # tag:src-processing
  2593. macro _SRC("asp", SRC, SRCFLAGS...) {
  2594. .CMD=$RUN_NO_SANITIZE ${tool:"tools/html2cpp"} ${input:SRC} ${output:SRC.cpp} ${kv;hide:"p HT"} ${kv;hide:"pc yellow"}
  2595. }
  2596. # tag:src-processing
  2597. macro _SRC("rl6", SRC, SRCFLAGS...) {
  2598. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel6"} $RAGEL6_FLAGS ${SRCFLAGS} -L -I${ARCADIA_ROOT} -o ${output;nopath;noext;defext=.rl6.cpp:SRC} ${input:SRC} ${kv;hide:"p R6"} ${kv;hide:"pc yellow"}
  2599. .SEM=target_ragel_lexers PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $RAGEL6_FLAGS ${SRCFLAGS} && set_global_flags RAGEL_FLAGS -L -I $S/ && conan_require_tool ragel/6.10 && conan_import '"bin, ragel* -> ./bin"' ${input;hide:"build/scripts/run_tool.py"}
  2600. }
  2601. # tag:src-processing
  2602. macro _SRC("pln", SRC, SRCFLAGS...) {
  2603. .CMD=$FML_TOOL -b -o ${output;pre=pln.;nopath;noext:SRC.cpp} -f ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  2604. }
  2605. # tag:src-processing
  2606. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  2607. .CMD=$YMAKE_PYTHON ${input:"library/cpp/xml/parslib/xsyn2ragel.py"} ${input:SRC} ${input:"library/cpp/xml/parslib/xmlpars.xh"} dontuse ${output;stdout:SRC.h.rl5} ${kv;hide:"p XN"} ${kv;hide:"pc yellow"}
  2608. }
  2609. # tag:src-processing
  2610. macro _SRC("ev", SRC, SRCFLAGS...) {
  2611. .CMD=$EVLOG_CMD($SRC)
  2612. .SEM=$EVLOG_CMD($SRC)
  2613. }
  2614. # tag:src-processing
  2615. macro _SRC("proto", SRC, SRCFLAGS...) {
  2616. .CMD=$PROTO_CMD($SRC)
  2617. .SEM=$PROTO_CMD($SRC)
  2618. }
  2619. # tag:src-processing
  2620. macro _SRC("gztproto", SRC, SRCFLAGS...) {
  2621. # _PROTO__INCLUDE is before ARCADIA_ROOT in includes because in gazetteer we don't use builtins now and paths' canonization (resolving) depends on order of roots.
  2622. # descriptor.proto must be resolved as google/protobuf/descriptor.proto
  2623. .CMD=${tool:"dict/gazetteer/converter"} -I$PROTOBUF_PATH ${pre="-I":_PROTO__INCLUDE} -I$ARCADIA_ROOT ${SRCFLAGS} ${input:SRC} ${output;nopath;noext;norel:SRC.proto} ${kv;hide:"p GZ"} ${kv;hide:"pc yellow"}
  2624. .PEERDIR=kernel/gazetteer/proto
  2625. }
  2626. # tag:src-processing
  2627. macro _SRC("cfgproto", SRC, SRCFLAGS...) {
  2628. .CMD=$_CPP_CFGPROTO_CMD($SRC)
  2629. }
  2630. # tag:src-processing
  2631. macro _SRC("pyx", SRC, SRCFLAGS...) {
  2632. # Copy-paste from BUILDWITH_CYTHON
  2633. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:SRC} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:SRC} $CYTHON_OUTPUT_INCLUDES ${SRCFLAGS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  2634. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS --cplus ${SRCFLAGS} ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  2635. .ADDINCL=FOR cython contrib/tools/cython/Cython/Includes
  2636. }
  2637. # tag:src-processing
  2638. macro _SRC("in", SRC, SRCFLAGS...) {
  2639. .CMD=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  2640. .SEM=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  2641. }
  2642. macro MANUAL_GENERATION(Outs...) {
  2643. .SEM=IGNORED ${output;hide;noauto:Outs}
  2644. }
  2645. # tag:src-processing
  2646. macro _SRC("sc", SRC, SRCFLAGS...) {
  2647. .CMD=${tool:"tools/domschemec"} --in ${input:SRC} --out ${output;norel:SRC.h} ${output_include;hide:"util/generic/strbuf.h"} ${output_include;hide:"array"} ${output_include;hide:"util/generic/string.h"} ${output_include;hide:"util/generic/vector.h"} ${output_include;hide:"util/string/cast.h"} ${SRCFLAGS} ${kv;hide:"p SC"} ${kv;hide:"pc yellow"}
  2648. }
  2649. # tag:src-processing
  2650. macro _SRC("ssqls", SRC, SRCFLAGS...) {
  2651. .CMD=${tool:"metrika/core/tools/ssqls"} ${input;notransformbuilddir:SRC} -S $ARCADIA_ROOT -B $ARCADIA_BUILD_ROOT $SRCFLAGS ${output;noext;hide:SRC.cpp} ${output;noext;hide:SRC.h} ${kv;hide:"p SS"} ${kv;hide:"pc yellow"}
  2652. }
  2653. # tag:src-processing
  2654. macro _SRC("f", SRC, SRCFLAGS...) {
  2655. .CMD=$YMAKE_PYTHON ${input:"build/scripts/f2c.py"} -t ${tool:"contrib/tools/f2c"} -c ${input:SRC} -o ${output:SRC.c} ${output_include;hide:"f2c.h"} ${kv;hide:"p FT"} ${kv;hide:"pc light-green"}
  2656. .PEERDIR=contrib/libs/libf2c
  2657. .ADDINCL=contrib/libs/libf2c
  2658. }
  2659. # tag:src-processing
  2660. macro _SRC("cpp", SRC, SRCFLAGS...) {
  2661. .CMD=$_SRC_cpp($SRC $SRCFLAGS)
  2662. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  2663. }
  2664. # tag:src-processing
  2665. macro _SRC("cxx", SRC, SRCFLAGS...) {
  2666. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  2667. }
  2668. # tag:src-processing
  2669. macro _SRC("cc", SRC, SRCFLAGS...) {
  2670. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  2671. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  2672. }
  2673. # tag:src-processing
  2674. macro _SRC("auxcpp", SRC, SRCFLAGS...) {
  2675. .CMD=$_SRC_cpp($SRC $_FORCE_CPP_FLAGS $SRCFLAGS)
  2676. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($_FORCE_CPP_FLAGS $SRCFLAGS)
  2677. }
  2678. # tag:src-processing
  2679. macro _SRC("C", SRC, SRCFLAGS...) {
  2680. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  2681. }
  2682. # tag:src-processing
  2683. macro _SRC("c", SRC, SRCFLAGS...) {
  2684. .CMD=$_SRC_c($SRC $SRCFLAGS)
  2685. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
  2686. }
  2687. # tag:src-processing
  2688. macro _SRC("m", SRC, SRCFLAGS...) {
  2689. .CMD=$_SRC(c $SRC $SRCFLAGS)
  2690. }
  2691. MASM_SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} \
  2692. && curdir_masm_flags ${MASMFLAGS}
  2693. YASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${pre=-P :PREINCLUDES} ${input;hide:"build/scripts/run_tool.py"} \
  2694. && set_global_flags YASM_FLAGS -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE \
  2695. && add_language ASM \
  2696. && conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  2697. ASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${input;hide:"build/scripts/run_tool.py"} \
  2698. && set_global_flags YASM_FLAGS -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE \
  2699. && add_language ASM \
  2700. && conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  2701. # tag:src-processing
  2702. macro _SRC("masm", SRC, SRCFLAGS...) {
  2703. .CMD=$_SRC_masm($SRC $SRCFLAGS)
  2704. .SEM=$MASM_SEM
  2705. }
  2706. # tag:src-processing
  2707. macro _SRC("yasm", SRC, SRCFLAGS...) {
  2708. .CMD=$_SRC_yasm($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  2709. .SEM=$YASM_SEM
  2710. }
  2711. # tag:src-processing
  2712. macro _SRC("asm", SRC, SRCFLAGS...) {
  2713. .CMD=$_SRC_ASM($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  2714. .SEM=$ASM_SEM
  2715. }
  2716. # tag:src-processing
  2717. macro _SRC("lua", SRC, SRCFLAGS...) {
  2718. .CMD=${cwd:LUAJIT_PATH} ${tool:"contrib/libs/luajit/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  2719. .PEERDIR=$LUAJIT_PATH
  2720. }
  2721. NVCC_CFLAGS=
  2722. when ($IDE_MSVS_CALL == "yes") {
  2723. # This is to avoid issues with .pdb from MSVC calling nvcc calling cl
  2724. NVCC_CFLAGS+=/Fd$(TEMP)
  2725. }
  2726. NVCC_STD_VER=14
  2727. when ($MSVC == "yes") {
  2728. NVCC_STD=/std:c++${NVCC_STD_VER}
  2729. }
  2730. otherwise {
  2731. NVCC_STD=-std=c++${NVCC_STD_VER}
  2732. }
  2733. # tag:src-processing
  2734. macro _SRC("cu", SRC, SRCFLAGS...) {
  2735. .CMD=$_SRC_CU_CMD
  2736. .SEM=target_cuda_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} && set_global_flags CMAKE_CUDA_STANDARD ${NVCC_STD_VER} && target_cuda_flags $CUDA_NVCC_FLAGS && target_cuda_cflags $USER_CXXFLAGS $SRCFLAGS $_SEM_EXTRA_CXX_FLAGS
  2737. .PEERDIR=$_SRC_CU_PEERDIR
  2738. }
  2739. # tag:src-processing
  2740. macro _SRC("fbs", SRC, SRCFLAGS...) {
  2741. .CMD=$FBS_CMD($SRC, $SRCFLAGS)
  2742. .SEM=$FBS_CMD($SRC, $SRCFLAGS)
  2743. }
  2744. # tag:src-processing
  2745. macro _SRC("fbs64", SRC, SRCFLAGS...) {
  2746. .CMD=$_CPP_FLATC64_CMD($SRC, $SRCFLAGS)
  2747. }
  2748. # tag:src-processing
  2749. macro _SRC("pysrc", SRC, SRCFLAGS...) {
  2750. .CMD=$_SRC_PYSRC($SRC, $SRCFLAGS)
  2751. }
  2752. # tag:src-processing
  2753. # This triggers configure error in attempt to add `ya.make` to SRCS macro or apply automatic processing by extension from codegen
  2754. macro _SRC("make", SRC, SRCFLAGS...) {
  2755. .CMD=
  2756. }
  2757. @import "${CONF_ROOT}/conf/bison_lex.conf"
  2758. # tag:src-processing
  2759. macro _SRC_py2src(SRC, SRCFLAGS...) {
  2760. .CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py2_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py2 --python $(PYTHON)/python --py_compile ${input:"build/scripts/py_compile.py"} ${kv;hide:"p P2"} ${kv;hide:"pc light-green"}
  2761. }
  2762. # tag:src-processing
  2763. macro _SRC_py3src(SRC, SRCFLAGS...) {
  2764. .CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py3_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py3 --pycc ${tool:"tools/py3cc"} ${kv;hide:"p P3"} ${kv;hide:"pc light-green"}
  2765. }
  2766. # tag:src-processing python-specific
  2767. when ($PYTHON3 == "yes") {
  2768. _SRC_PYSRC_CMDLINE=$_SRC_py3src($SRC $SRCFLAGS)
  2769. }
  2770. otherwise {
  2771. _SRC_PYSRC_CMDLINE=$_SRC_py2src($SRC $SRCFLAGS)
  2772. }
  2773. # tag:src-processing tag:python-specific
  2774. macro _SRC_PYSRC(SRC, SRCFLAGS...) {
  2775. .CMD=$_SRC_PYSRC_CMDLINE
  2776. }
  2777. # tag:src-processing
  2778. macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
  2779. .CMD=$_SRC_C_NODEPS_CMD
  2780. }
  2781. # Custom flags for generated cpp-files. To support another generator:
  2782. # - insert additional file extension before .cpp into generated cpp-file name
  2783. # - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list
  2784. #
  2785. # ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
  2786. # This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
  2787. #
  2788. # cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
  2789. # We use cython==0.29.26 at the time. This issue might be fixed in further versions.
  2790. #
  2791. # flags -fno-profile-instr-generate -fno-coverage-mapping needed to always disable coverage for .pyx, .rl5, .rl6
  2792. # generated sources
  2793. ## tag:src-processing
  2794. when ($CLANG == "yes") {
  2795. _LANG_CFLAGS_FILTER=\
  2796. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl5:SRC} \
  2797. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl6:SRC} \
  2798. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.pyx:SRC}
  2799. }
  2800. otherwise {
  2801. _LANG_CFLAGS_FILTER=\
  2802. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
  2803. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
  2804. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
  2805. }
  2806. # tag:src-processing
  2807. # Magic macro for removing file name from result (file name is passed as unused SKIP parameter)
  2808. macro _FILTER_EXTS(SKIP="", FLAGS...) {
  2809. .CMD=$FLAGS
  2810. }
  2811. # tag:src-processing
  2812. macro _LANG_CFLAGS(SRC) {
  2813. .CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER)
  2814. }
  2815. # tag:src-processing
  2816. # ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
  2817. # Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
  2818. _LANG_CFLAGS_VALUE=
  2819. when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
  2820. _LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
  2821. }
  2822. # Allows to add single compilation unit name to the node's 'kv' section.
  2823. # This is used by the coverage machinery to instrument only the necessary sources
  2824. # when --coverage-prefix-filter <rootrelpath> is specified. For more info see DEVTOOLSSUPPORT-16891
  2825. SCU_NAME_KV=
  2826. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no" && $USE_SCU_VALUE == "yes") {
  2827. SCU_NAME_KV=${hide;kv:"scu_name $KV_VAL"}
  2828. }
  2829. macro _ADD_SCU_NAME(KV_VAL) {
  2830. .CMD=$SCU_NAME_KV
  2831. }
  2832. # tag:src-processing
  2833. macro _SRC_cpp(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  2834. .CMD=$_SRC_CPP_CMD $_ADD_SCU_NAME(${input:SRC})
  2835. }
  2836. # tag:src-processing
  2837. macro _SRC_c(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  2838. .CMD=$_SRC_C_CMD $_ADD_SCU_NAME(${input:SRC})
  2839. }
  2840. # tag:src-processing
  2841. macro _SRC_m(SRC, SRCFLAGS...) {
  2842. .CMD=$_SRC_M_CMD
  2843. }
  2844. # tag:src-processing
  2845. macro _SRC_masm(SRC, SRCFLAGS...) {
  2846. .CMD=$_SRC_MASM_CMD
  2847. }
  2848. # tag:lua-specific
  2849. ### @usage: COMPILE_LUA(Src, [NAME <import_name>])
  2850. ###
  2851. ### Compile LUA source file to object code using LUA 2.0
  2852. ### Optionally override import name which is by default reflects Src name
  2853. macro COMPILE_LUA(Src, NAME="") {
  2854. .CMD=$_SRC(lua, $Src, ${pre=-n :NAME})
  2855. }
  2856. # tag:lua-specific
  2857. ### @usage: _SRC_lua_21(SRC [SRCFLAGS...]) # internal
  2858. ###
  2859. ### Compile LUA source file to object code using LUA 2.1
  2860. macro _SRC_lua_21(SRC, SRCFLAGS...) {
  2861. .CMD=${cwd:LUAJIT_21_PATH} ${tool:"contrib/libs/luajit_21/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  2862. .PEERDIR=$LUAJIT_21_PATH
  2863. }
  2864. # tag:lua-specific
  2865. ### @usage: COMPILE_LUA_21(Src, [NAME <import_name>])
  2866. ###
  2867. ### Compile LUA source file to object code using LUA 2.1
  2868. ### Optionally override import name which is by default reflects Src name
  2869. macro COMPILE_LUA_21(Src, NAME="") {
  2870. .CMD=$_SRC_lua_21($Src, ${pre=-n :NAME})
  2871. }
  2872. # tag:lua-specific
  2873. ### @usage: _SRC_lua_openresty(SRC [SRCFLAGS...]) # internal
  2874. ###
  2875. ### Compile LUA source file to object code using OpenResty LUA 2.1
  2876. macro _SRC_lua_openresty(SRC, SRCFLAGS...) {
  2877. .CMD=${cwd:LUAJIT_OPENRESTY_PATH} ${tool:"contrib/libs/luajit_openresty/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  2878. .PEERDIR=$LUAJIT_OPENRESTY_PATH
  2879. }
  2880. # tag:lua-specific
  2881. ### @usage: COMPILE_LUA_OPENRESTY(Src, [NAME <import_name>])
  2882. ###
  2883. ### Compile LUA source file to object code using OpenResty LUA 2.1
  2884. ### Optionally override import name which is by default reflects Src name
  2885. macro COMPILE_LUA_OPENRESTY(Src, NAME="") {
  2886. .CMD=$_SRC_lua_openresty($Src, ${pre=-n :NAME})
  2887. }
  2888. GETTEXT_KEEP_PATH=no
  2889. _MO_OUTPUT=
  2890. when ($GETTEXT_KEEP_PATH == "yes") {
  2891. _MO_OUTPUT=${output;noauto;norel;noext:SRC.mo}
  2892. }
  2893. otherwise {
  2894. _MO_OUTPUT=${output;noauto;nopath;noext;tobindir:SRC.mo}
  2895. }
  2896. # tag:src-processing
  2897. macro _SRC("po", SRC, SRCFLAGS...) {
  2898. .CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
  2899. }
  2900. # tag:ydl-specific
  2901. YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
  2902. YDL_DESC_FLAGS=
  2903. # tag:src-processing tag:ydl-specific
  2904. macro _SRC("ydl", SRC, SRCFLAGS...) {
  2905. .CMD=${tool:"statbox/ydl/compiler/tooling/ydl/bin"} c $YDL_FLAGS --cpp-output-header ${output;suf=.h:SRC} --cpp-output-source ${output;suf=.cpp:SRC} ${input:SRC} ${output_include;hide:"statbox/ydl/runtime/cpp/gen_support/standard_includes.h"} ${kv;hide:"p YDL"} ${kv;hide:"pc yellow"}
  2906. .PEERDIR+=statbox/ydl/runtime/cpp
  2907. }
  2908. # tag:ydl-specific
  2909. ### @usage BUILD_YDL_DESC(Input Symbol Output)
  2910. ###
  2911. ### Generate a descriptor for a Symbol located in a ydl module Input, and put it to the file Output.
  2912. ###
  2913. ### @example:
  2914. ###
  2915. ### PACKAGE()
  2916. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  2917. ### END()
  2918. ###
  2919. ### This will parse file ../types.ydl, generate a descriptor for a symbol Event defined in the said file, and put the descriptor to the Event.ydld.
  2920. macro BUILD_YDL_DESC(Input, Symbol, Output) {
  2921. .CMD=${tool:"statbox/ydl/compiler/tooling/ydl/bin"} ti $YDL_FLAGS $YDL_DESC_FLAGS -o ${output;noauto:Output} ${input:Input} ${Symbol} ${kv;hide:"p YDL"} ${kv;hide:"pc yellow"}
  2922. }
  2923. # tag:ydl-specific
  2924. ### @usage: YDL_DESC_USE_BINARY()
  2925. ###
  2926. ### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
  2927. ###
  2928. ### @example:
  2929. ###
  2930. ### PACKAGE()
  2931. ### YDL_DESC_USE_BINARY()
  2932. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  2933. ### END()
  2934. ###
  2935. ### This will generate descriptor Event.ydld in a binary format.
  2936. macro YDL_DESC_USE_BINARY() {
  2937. YDL_DESC_FLAGS_BINARY= --binary
  2938. SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
  2939. }
  2940. ### @usage SRC(File Flags...)
  2941. ###
  2942. ### Compile single file with extra Flags.
  2943. ### Compilation is driven by the last extension of the File and Flags are specific to corresponding compilation command
  2944. macro SRC(FILE, FLAGS...) {
  2945. _SRC(${lastext:FILE} $FILE $FLAGS)
  2946. }
  2947. ### @usage: SRCS(<[GLOBAL] File> ...)
  2948. ###
  2949. ### Source files of the project. Files are built according to their extension and put int module output or fed to ultimate PROGRAM/DLL depending on GLOBAL presence.
  2950. ### Arcadia Paths from the root and is relative to the project's LIST are supported
  2951. ###
  2952. ### GLOBAL marks next file as direct input to link phase of the program/shared library project built into. This prevents symbols of the file to be excluded by linker as unused.
  2953. ### The scope of the GLOBAL keyword is the following file (that is, in the case of SRCS(GLOBAL foo.cpp bar.cpp) global will be only foo.cpp)
  2954. ###
  2955. ### @example:
  2956. ###
  2957. ### LIBRARY(test_global)
  2958. ### SRCS(GLOBAL foo.cpp)
  2959. ### END()
  2960. ###
  2961. ### This will produce foo.o and feed it to any PROGRAM/DLL module transitively depending on test_global library. The library itself will be empty and won't produce .a file.
  2962. macro SRCS(FILES...) {
  2963. foreach (FILE : $FILES) {
  2964. _SRC(${lastext:FILE} $FILE)
  2965. }
  2966. }
  2967. # tag:c-specific
  2968. macro _SRC_C_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  2969. .CMD=$_SRC_c($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  2970. .SEM=target_sources_custom $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL
  2971. }
  2972. macro _SRC_CPP_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  2973. .CMD=$_SRC_cpp($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  2974. .SEM=target_sources_custom $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS
  2975. }
  2976. # tag:src-specific tag:cpp-specific
  2977. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  2978. ###
  2979. ### Defenition of generic macro. Report an error that the File with Ext is not
  2980. ### supported by macro MacroName if no appropriate macro specialization is found.
  2981. macro _SRC_CUSTOM_C_CPP(EXT, MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  2982. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  2983. }
  2984. # tag:src-specific tag:cpp-specific
  2985. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  2986. ###
  2987. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single C file (with .c extension)
  2988. macro _SRC_CUSTOM_C_CPP("c", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  2989. _SRC_C_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  2990. }
  2991. # tag:src-specific tag:cpp-specific
  2992. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  2993. ###
  2994. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cpp extension)
  2995. macro _SRC_CUSTOM_C_CPP("cpp", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  2996. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  2997. }
  2998. # tag:src-specific tag:cpp-specific
  2999. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3000. ###
  3001. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cxx extension)
  3002. macro _SRC_CUSTOM_C_CPP("cxx", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3003. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3004. }
  3005. # tag:src-specific tag:cpp-specific
  3006. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3007. ###
  3008. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cc extension)
  3009. macro _SRC_CUSTOM_C_CPP("cc", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3010. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3011. }
  3012. # tag:src-specific tag:cpp-specific
  3013. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3014. ###
  3015. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .C extension)
  3016. macro _SRC_CUSTOM_C_CPP("C", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3017. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3018. }
  3019. # tag:src-specific tag:cpp-specific tag:cpu
  3020. ### @uasge SRC_C_SSE2(File Flags...)
  3021. ###
  3022. ### Compile a single C/C++ file with SSE2 and additional Flags
  3023. macro SRC_C_SSE2(FILE, FLAGS...) {
  3024. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE2 $FILE .sse2 $SSE2_CFLAGS $FLAGS)
  3025. }
  3026. # tag:src-specific tag:cpp-specific tag:cpu
  3027. ### @uasge SRC_C_SSE3(File Flags...)
  3028. ###
  3029. ### Compile a single C/C++ file with SSE3 and additional Flags
  3030. macro SRC_C_SSE3(FILE, FLAGS...) {
  3031. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE3 $FILE .sse3 $SSE3_CFLAGS $FLAGS)
  3032. }
  3033. # tag:src-specific tag:cpp-specific tag:cpu
  3034. ### @uasge SRC_C_SSSE3(File Flags...)
  3035. ###
  3036. ### Compile a single C/C++ file with SSSE3 and additional Flags
  3037. macro SRC_C_SSSE3(FILE, FLAGS...) {
  3038. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSSE3 $FILE .ssse3 $SSSE3_CFLAGS $FLAGS)
  3039. }
  3040. # tag:src-specific tag:cpp-specific tag:cpu
  3041. ### @uasge SRC_C_SSE4(File Flags...)
  3042. ###
  3043. ### Compile a single C/C++ file with SSE4 and additional Flags
  3044. macro SRC_C_SSE4(FILE, FLAGS...) {
  3045. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE4 $FILE .sse4 $SSE4_CFLAGS $FLAGS)
  3046. }
  3047. # tag:src-specific tag:cpp-specific tag:cpu
  3048. ### @uasge SRC_C_SSE41(File Flags...)
  3049. ###
  3050. ### Compile a single C/C++ file with SSE4.1 and additional Flags
  3051. macro SRC_C_SSE41(FILE, FLAGS...) {
  3052. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE41 $FILE .sse41 $SSE41_CFLAGS $FLAGS)
  3053. }
  3054. # tag:src-specific tag:cpp-specific tag:cpu
  3055. ### @uasge SRC_C_AVX(File Flags...)
  3056. ###
  3057. ### Compile a single C/C++ file with AVX and additional Flags
  3058. macro SRC_C_AVX(FILE, FLAGS...) {
  3059. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX $FILE .avx $AVX_CFLAGS $FLAGS)
  3060. }
  3061. # tag:src-specific tag:cpp-specific tag:cpu
  3062. ### @uasge SRC_C_AVX2(File Flags...)
  3063. ###
  3064. ### Compile a single C/C++ file with AVX2 and additional Flags
  3065. macro SRC_C_AVX2(FILE, FLAGS...) {
  3066. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX2 $FILE .avx2 $AVX2_CFLAGS $FLAGS)
  3067. }
  3068. # tag:src-specific tag:cpp-specific tag:cpu
  3069. ### @uasge SRC_C_AVX512(File Flags...)
  3070. ###
  3071. ### Compile a single C/C++ file with AVX512 and additional Flags
  3072. macro SRC_C_AVX512(FILE, FLAGS...) {
  3073. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX512 $FILE .avx512 $AVX512_CFLAGS $FLAGS)
  3074. }
  3075. # tag:src-specific tag:cpp-specific tag:cpu
  3076. ### @uasge SRC_C_AVX512(File Flags...)
  3077. ###
  3078. ### Compile a single C/C++ file with AVX512 and additional Flags
  3079. macro SRC_C_AMX(FILE, FLAGS...) {
  3080. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AMX $FILE .amx $AMX_CFLAGS $FLAGS)
  3081. }
  3082. # tag:src-specific tag:cpp-specific tag:cpu
  3083. ### @uasge SRC_C_XOP(File Flags...)
  3084. ###
  3085. ### Compile a single C/C++ file with (an AMD-specific instruction set,
  3086. ### see https://en.wikipedia.org/wiki/XOP_instruction_set) and additional Flags
  3087. macro SRC_C_XOP(FILE, FLAGS...) {
  3088. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_XOP $FILE .xop $XOP_CFLAGS $FLAGS)
  3089. }
  3090. # tag:src-specific tag:cpp-specific tag:cpu
  3091. ### @uasge SRC_C_PCLMUL(File Flags...)
  3092. ###
  3093. ### Compile a single C/C++ file with PCLMUL and additional Flags
  3094. macro SRC_C_PCLMUL(FILE, FLAGS...) {
  3095. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_PCLMUL $FILE .pclmul $PCLMUL_CFLAGS $FLAGS )
  3096. }
  3097. # tag:src-specific tag:cpp-specific
  3098. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3099. ###
  3100. ### Defenition of generic macro. Report an error that the File with Ext is not
  3101. ### supported by macro MacroName if no appropriate macro specialization is found.
  3102. macro _SRC_STRICT_C_CPP(EXT, MACRO_NAME, FILE, FLAGS...) {
  3103. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  3104. }
  3105. # tag:src-specific tag:cpp-specific
  3106. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3107. ###
  3108. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single C file (with .c extension)
  3109. macro _SRC_STRICT_C_CPP("c", MACRO_NAME, FILE, FLAGS...) {
  3110. _SRC(c $FILE $FLAGS)
  3111. }
  3112. # tag:src-specific tag:cpp-specific
  3113. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3114. ###
  3115. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cpp extension)
  3116. macro _SRC_STRICT_C_CPP("cpp", MACRO_NAME, FILE, FLAGS...) {
  3117. _SRC(cpp $FILE $FLAGS)
  3118. }
  3119. # tag:src-specific tag:cpp-specific
  3120. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3121. ###
  3122. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cxx extension)
  3123. macro _SRC_STRICT_C_CPP("cxx", MACRO_NAME, FILE, FLAGS...) {
  3124. _SRC(cpp $FILE $FLAGS)
  3125. }
  3126. # tag:src-specific tag:cpp-specific
  3127. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3128. ###
  3129. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cc extension)
  3130. macro _SRC_STRICT_C_CPP("cc", MACRO_NAME, FILE, FLAGS...) {
  3131. _SRC(cpp $FILE $FLAGS)
  3132. }
  3133. # tag:src-specific tag:cpp-specific
  3134. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3135. ###
  3136. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .C extension)
  3137. macro _SRC_STRICT_C_CPP("C", MACRO_NAME, FILE, FLAGS...) {
  3138. _SRC(cpp $FILE $FLAGS)
  3139. }
  3140. # tag:src-specific tag:cpp-specific
  3141. ### @uasge SRC_C_PIC(File Flags...)
  3142. ###
  3143. ### Compile a single C/C++ file with -fPIC and additional Flags
  3144. macro SRC_C_PIC(FILE, FLAGS...) {
  3145. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PIC $FILE $PIC_CFLAGS $FLAGS)
  3146. }
  3147. # tag:src-specific tag:cpp-specific
  3148. ### @uasge SRC_C_NO_LTO(File Flags...)
  3149. ###
  3150. ### Compile a single C/C++ file with link-time-optimization disabling and additional Flags
  3151. macro SRC_C_NO_LTO(FILE, FLAGS...) {
  3152. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_NO_LTO $FILE $NO_LTO_CFLAGS $FLAGS)
  3153. }
  3154. # tag:python-processing tag:cython
  3155. # TODO: use it in [.pyx] cmd
  3156. ### @usage: BUILDWITH_CYTHON_CPP(Src Options...)
  3157. ###
  3158. ### Generates .cpp file from .pyx.
  3159. macro BUILDWITH_CYTHON_CPP(Src, Options...) {
  3160. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3161. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  3162. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3163. }
  3164. # tag:python-processing tag:cython tag:internal
  3165. ### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal
  3166. ###
  3167. ### Generates .cpp file from .pyx and attach extra input Dep.
  3168. ### If Dep changes the .cpp file will be re-generated.
  3169. macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) {
  3170. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3171. .SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  3172. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3173. }
  3174. # tag:python-processing tag:cython tag:internal
  3175. ### @usage: _BUILDWITH_CYTHON_CPP_H(Src Dep Options...) # internal
  3176. ###
  3177. ### BUILDWITH_CYTHON_CPP without .pyx infix and with cdef public .h file.
  3178. macro _BUILDWITH_CYTHON_CPP_H(Src, Dep, Options...) {
  3179. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.cpp} ${output;hide;addincl;noext;tobindir:Src.h} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3180. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3181. }
  3182. # tag:python-processing tag:cython
  3183. ### @usage: BUILDWITH_CYTHON_C(Src Options...)
  3184. ###
  3185. ### Generates .c file from .pyx.
  3186. macro BUILDWITH_CYTHON_C(Src, Options...) {
  3187. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3188. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  3189. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3190. }
  3191. # tag:python-processing tag:cython tag:internal
  3192. ### @usage: _BUILDWITH_CYTHON_C_DEP(Src Dep Options...) # internal
  3193. ###
  3194. ### Generates .c file from .pyx and attach extra input Dep.
  3195. ### If Dep changes the .c file will be re-generated.
  3196. macro _BUILDWITH_CYTHON_C_DEP(Src, Dep, Options...) {
  3197. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3198. .SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  3199. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3200. }
  3201. # tag:python-processing tag:cython tag:internal
  3202. ### @usage: _BUILDWITH_CYTHON_C_H(Src Dep Options...) # internal
  3203. ###
  3204. ### BUILDWITH_CYTHON_C without .pyx infix and with cdef public .h file.
  3205. macro _BUILDWITH_CYTHON_C_H(Src, Dep, Options...) {
  3206. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3207. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3208. }
  3209. # tag:python-processing tag:cython tag:internal
  3210. ### @usage: _BUILDWITH_CYTHON_C_API_H(Src Dep Options...) # internal
  3211. ###
  3212. ### BUILDWITH_CYTHON_C_H with cdef api _api.h file.
  3213. macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) {
  3214. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} ${output;hide;addincl;noext;defext=_api.h;tobindir:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3215. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3216. }
  3217. ### @usage: BUILDWITH_RAGEL6(Src Options...)
  3218. ###
  3219. ### Compile .rl file using Ragel6.
  3220. macro BUILDWITH_RAGEL6(Src, Options...) {
  3221. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel6"} $RAGEL6_FLAGS ${Options} -I${ARCADIA_ROOT} -o ${output;nopath;noext;defext=.rl6.cpp:Src} ${input:Src} ${kv;hide:"p R6"} ${kv;hide:"pc yellow"}
  3222. }
  3223. # tag:python-processing tag:internal
  3224. # TODO: use it in [.pyx] cmd
  3225. ### @usage: _PY_REGISTER() # internal
  3226. ###
  3227. ### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive.
  3228. ###
  3229. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3230. macro _PY_REGISTER(Func) {
  3231. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${output;noauto:Func.reg.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  3232. SRCS(GLOBAL $Func.reg.cpp)
  3233. }
  3234. # tag:python-processing tag:internal
  3235. ### @usage: _PY3_REGISTER() # internal
  3236. ###
  3237. ### Register Python 3.x module in internal resource file system. Arcadia Python 3.x importer will be retrieve these on import directive
  3238. ###
  3239. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3240. macro _PY3_REGISTER(Func) {
  3241. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py3_reg.py"} $Func ${output;noauto:Func.reg3.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  3242. SRCS(GLOBAL $Func.reg3.cpp)
  3243. }
  3244. # tag:python-processing tag:internal
  3245. ### @usage: _PY_COMPILE_BYTECODE(SrcX Src) # internal
  3246. ###
  3247. ### Compile Python 2.x .py source file into Arcadia binary form suitable for PY2_PROGRAM
  3248. ###
  3249. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3250. macro _PY_COMPILE_BYTECODE(SrcX, Src, Dst) {
  3251. .CMD=$YMAKE_PYTHON ${input:"build/scripts/py_compile.py"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  3252. }
  3253. # tag:python-processing tag:internal
  3254. ### @usage: _PY3_COMPILE_BYTECODE(SrcX Src) # internal
  3255. ###
  3256. ### Compile Python 3.x .py source file into Arcadia binary form suitable for PY3_PROGRAM
  3257. ###
  3258. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3259. macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) {
  3260. .CMD=${env:"PYTHONHASHSEED=0"} ${tool:"tools/py3cc"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc3} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  3261. }
  3262. macro _ARCHIVE_SEM_HELPER(FLAGS[], OUT, Files...) {
  3263. .SEM=add_custom_command OUTPUT ${OUT} DEPENDS $ARCH_TOOL ${join= :Files} COMMAND $ARCH_TOOL $FLAGS ${join=\: :Files}: -o ${OUT}
  3264. }
  3265. ### @usage: ARCHIVE_ASM(NAME archive_name files...)
  3266. ###
  3267. ### Similar to the macro ARCHIVE, but:
  3268. ### 1. works faster and it is better to use for large files.
  3269. ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test)
  3270. macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  3271. .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;suf=$OBJ_SUF.rodata:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"}
  3272. .SEM=$_ARCHIVE_SEM_HELPER(${output;suf=$OBJ_SUF.rodata:NAME} ${input:Files} FLAGS -q $DONTCOMPRESS)
  3273. }
  3274. # tag:yweb-specific
  3275. macro PIRE_INLINE_CMD(SRC) {
  3276. .CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${output_include;hide:SRC} ${kv;hide:"p PI"} ${kv;hide:"pc yellow"}
  3277. }
  3278. # tag:yweb-specific
  3279. macro PIRE_INLINE(FILES...) {
  3280. foreach (FILE : $FILES) {
  3281. PIRE_INLINE_CMD($FILE)
  3282. }
  3283. }
  3284. ### @usage: ARCHIVE(archive_name [DONT_COMPRESS] files...)
  3285. ###
  3286. ### Add arbitrary data to a modules. Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  3287. ###
  3288. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  3289. macro ARCHIVE(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  3290. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  3291. .SEM=$_ARCHIVE_SEM_HELPER(${output;addincl;noauto:NAME} ${input:Files} FLAGS -q -x $DONTCOMPRESS) && target_sources PRIVATE $BINDIR/$NAME
  3292. }
  3293. ### @usage: ARCHIVE_BY_KEYS(archive_name key [DONT_COMPRESS] files...)
  3294. ###
  3295. ### Add arbitrary data to a module be accessible by specified key.
  3296. ### Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  3297. ###
  3298. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  3299. macro ARCHIVE_BY_KEYS(NAME="", KEYS="", DONTCOMPRESS?"-p":"", Files...) {
  3300. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input:Files} -k $KEYS -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  3301. }
  3302. #scripts
  3303. #special commands
  3304. BUILDVERSION_SCRIPT=build/scripts/build_info_gen.py
  3305. SVNVERSION_JAVA_MARKER=output-java-class
  3306. SVNVERSION_GO_MARKER=output-go
  3307. VCS_C_OBJ=$BINDIR/__vcs_version__.c$OBJECT_SUF
  3308. VCS_C_OBJ_RR=$MODDIR/__vcs_version__.c$OBJECT_SUF
  3309. VCS_C=$BINDIR/__vcs_version__.c
  3310. VCS_GO=$BINDIR/__vcs_version__.go
  3311. VCS_JAVA=$BINDIR/__vcs_version__.mf
  3312. VCS_INFO_DISABLE_CACHE__NO_UID__=
  3313. YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  3314. CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  3315. CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=
  3316. YASM_DEBUG_INFO=
  3317. CL_DEBUG_INFO=
  3318. CL_MACRO_INFO=
  3319. when ($FORCE_VCS_INFO_UPDATE == "yes") {
  3320. VCS_INFO_DISABLE_CACHE__NO_UID__=${hide;kv:"disable_cache"}
  3321. }
  3322. ### Works for pyton too.
  3323. GENERATE_VCS_C_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} $(VCS)/vcs.json $VCS_C ${input:"build/scripts/c_templates/svn_interface.c"} $VCS_INFO_DISABLE_CACHE__NO_UID__ && $_SRC_c_nodeps($VCS_C, $VCS_C_OBJ, $(SOURCE_ROOT))
  3324. GENERATE_VCS_GO_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-go $(VCS)/vcs.json $VCS_GO $GO_ARCADIA_PROJECT_PREFIX $VCS_INFO_DISABLE_CACHE__NO_UID__
  3325. GENERATE_VCS_JAVA_INFO_NODEP=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $VCS_INFO_DISABLE_CACHE__NO_UID__
  3326. macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) {
  3327. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__
  3328. }
  3329. VCS_INFO_FILE=
  3330. ### @usage VCS_INFO_FILE([FILE out_file])
  3331. ###
  3332. ### Enable saving vcs info as a json-file into PACKAGE
  3333. ###
  3334. ### Info is saved to 'vcs_info.json' by default.
  3335. ### Use FILE parameter if you want another name.
  3336. ###
  3337. ### Note: macro can be used only once per module
  3338. macro VCS_INFO_FILE(FILE="vcs_info.json") {
  3339. SET(VCS_INFO_FILE $FILE)
  3340. }
  3341. ADD_VCS_INFO_FILE_CMD=
  3342. when ($VCS_INFO_FILE) {
  3343. ADD_VCS_INFO_FILE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-json $(VCS)/vcs.json ${output:VCS_INFO_FILE} $VCS_INFO_DISABLE_CACHE__NO_UID__
  3344. }
  3345. ### @usage: CREATE_BUILDINFO_FOR(GenHdr)
  3346. ###
  3347. ### Creates header file to access some information about build specified via configuration variables.
  3348. ### Unlike CREATE_SVNVERSION_FOR() it doesn't take revion information from VCS, it uses revision and SandboxTaskId passed via -D options to ya make
  3349. macro CREATE_BUILDINFO_FOR(GenHdr) {
  3350. .CMD=$YIELD $CXX_COMPILER && $YIELD $CXXFLAGS && $XARGS $YMAKE_PYTHON3 ${input:BUILDVERSION_SCRIPT} ${output:GenHdr} ${kv;hide:"p BI"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"} $SVN_DEPENDS_CACHE__NO_UID__
  3351. .SEM=$RUN_PYTHON3($BUILDVERSION_SCRIPT $GenHdr \\\"${CMAKE_CXX_COMPILER}\\\" \\\"${CMAKE_CXX_FLAGS}\\\" OUT $GenHdr)
  3352. }
  3353. DECIMAL_MD5_SCRIPT=build/scripts/decimal_md5.py
  3354. DECIMAL_MD5_FIXED=
  3355. ### @usage: DECIMAL_MD5_LOWER_32_BITS(<fileName> [FUNCNAME funcName] [inputs...])
  3356. ###
  3357. ### Generates .cpp file <fileName> with one defined function 'const char* <funcName>() { return "<calculated_md5_hash>"; }'.
  3358. ### <calculated_md5_hash> will be md5 hash for all inputs passed to this macro.
  3359. macro DECIMAL_MD5_LOWER_32_BITS(File, FUNCNAME="", Opts...) {
  3360. .CMD=$YMAKE_PYTHON ${input:DECIMAL_MD5_SCRIPT} --fixed-output=${DECIMAL_MD5_FIXED} --func-name=${FUNCNAME} --lower-bits 32 --source-root=$ARCADIA_ROOT ${input;context=TEXT:Opts} ${output;stdout:File} ${kv;hide:"p SV"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"}
  3361. }
  3362. # tag:internal
  3363. ### @usage $CFG_VARS # internal
  3364. ###
  3365. ### Mark commands that embed Configuration variables into files
  3366. macro CFG_VARS() {
  3367. .GEN_FROM_FILE=yes
  3368. }
  3369. ### @usage: CONFIGURE_FILE(from to)
  3370. ###
  3371. ### Copy file with the replacement of configuration variables in form of @ANY_CONF_VAR@ with their values.
  3372. ### The values are collected during configure stage, while replacement itself happens during build stage.
  3373. ### Used implicitly for .in-files processing.
  3374. macro CONFIGURE_FILE(Src, Dst) {
  3375. .CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${kv;hide:"p CF"} ${kv;hide:"pc yellow"}
  3376. .SEM=set_vars ${CFG_VARS} && configure_file $S/${input;rootrel:Src} $B/${output;addincl;rootrel:Dst}
  3377. }
  3378. ### @usage: BASE_CODEGEN(tool_path prefix)
  3379. ###
  3380. ### Generator ${prefix}.cpp + ${prefix}.h files based on ${prefix}.in.
  3381. macro BASE_CODEGEN(Tool, Prefix, Opts...) {
  3382. .CMD=${tool:Tool} ${input:Prefix.in} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc yellow"}
  3383. }
  3384. # tag:internal
  3385. ### @usage: _SPLIT_CODEGEN_BASE(tool prefix OUTS[] OUTPUT_INCLUDES[]) # internal
  3386. ###
  3387. ### Generator of a certain number .the. cpp file + one header .h file from .in.
  3388. ### This is the call of the generator. Python macro SPLIT_CODEGEN() is defined in order to properly fill command outputs from OUT_NUM argument.
  3389. macro _SPLIT_CODEGEN_BASE(Tool, Prefix, OUT[], OPTS[], OUTPUT_INCLUDES[]) {
  3390. .CMD=${tool:Tool} ${input:Prefix.in} ${output;hide:OUT} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $OPTS ${output_include;hide:OUTPUT_INCLUDES} ${kv;hide:"p SC"} ${kv;hide:"pc yellow"}
  3391. }
  3392. STRUCT_CODEGEN_OUTPUT_INCLUDES=${output_include;hide:"util/generic/singleton.h"} \
  3393. ${output_include;hide:"util/generic/strbuf.h"} \
  3394. ${output_include;hide:"util/generic/vector.h"} \
  3395. ${output_include;hide:"util/generic/ptr.h"} \
  3396. ${output_include;hide:"util/generic/yexception.h"} \
  3397. ${output_include;hide:"kernel/struct_codegen/reflection/reflection.h"} \
  3398. ${output_include;hide:"kernel/struct_codegen/reflection/floats.h"}
  3399. ### @usage: STRUCT_CODEGEN(Prefix)
  3400. ### A special case BASE_CODEGEN, in which the kernel/struct_codegen/codegen_tool tool is used.
  3401. macro STRUCT_CODEGEN(Prefix) {
  3402. .CMD=$BASE_CODEGEN(kernel/struct_codegen/codegen_tool, $Prefix, $STRUCT_CODEGEN_OUTPUT_INCLUDES)
  3403. .PEERDIR=kernel/struct_codegen/metadata kernel/struct_codegen/reflection
  3404. }
  3405. ### @usage: DUMPERF_CODEGEN(Prefix)
  3406. ### A special case BASE_CODEGEN, in which the extsearch/images/robot/tools/dumperf/codegen tool is used
  3407. macro DUMPERF_CODEGEN(Prefix) {
  3408. .CMD=$BASE_CODEGEN(extsearch/images/robot/tools/dumperf/codegen, $Prefix, ${output_include;hide:"extsearch/images/kernel/erf/erf_format.h"})
  3409. }
  3410. # tag:flags
  3411. ### @usage: LDFLAGS(LinkerFlags...)
  3412. ###
  3413. ### Add flags to the link command line of executable or shared library/dll.
  3414. ### Note: LDFLAGS are always global. When set in the LIBRARY module they will affect all programs/dlls/tests the library is linked into.
  3415. ### Note: remember about the incompatibility of flags for gcc and cl.
  3416. macro LDFLAGS(Flags...) {
  3417. SET_APPEND(LDFLAGS_GLOBAL $Flags)
  3418. }
  3419. # tag:flags
  3420. ### @usage: CFLAGS([GLOBAL compiler_flag]* compiler_flags)
  3421. ###
  3422. ### Add the specified flags to the compilation command of C and C++ files.
  3423. ### @params: GLOBAL - Propagates these flags to dependent projects
  3424. ### Note: remember about the incompatibility flags for clang and cl (to set flags specifically for cl.exe use MSVC_FLAGS).
  3425. macro CFLAGS(Flags...) {
  3426. SET_APPEND_WITH_GLOBAL(USER_CFLAGS $Flags)
  3427. }
  3428. # tag:flags
  3429. ### @usage: MASMFLAGS(compiler flags)
  3430. ### Add the specified flags to the compilation command of .masm files.
  3431. macro MASMFLAGS(Flags...) {
  3432. SET_APPEND(MASMFLAGS $Flags)
  3433. }
  3434. # tag:flags
  3435. ### @usage: CONLYFLAGS([GLOBAL compiler_flag]* compiler_flags)
  3436. ### Add the specified flags to the compilation command of .c (but not .cpp) files.
  3437. ### @params: GLOBAL - Distributes these flags on dependent projects
  3438. macro CONLYFLAGS(Flags...) {
  3439. SET_APPEND_WITH_GLOBAL(USER_CONLYFLAGS $Flags)
  3440. }
  3441. # tag:flags
  3442. ### @usage: CXXFLAGS(compiler_flags)
  3443. ### Add the specified flags to the compilation command of .cpp (but not .c) files.
  3444. macro CXXFLAGS(Flags...) {
  3445. SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags)
  3446. }
  3447. # tag:flags
  3448. ### @usage: CUDA_NVCC_FLAGS(compiler flags)
  3449. ### Add the specified flags to the compile line .cu-files.
  3450. macro CUDA_NVCC_FLAGS(Flags...) {
  3451. SET_APPEND(CUDA_NVCC_FLAGS $Flags)
  3452. }
  3453. # tag:flags
  3454. ### @usage: NVCC_DEVICE_LINK(file.cu...)
  3455. ### Run nvcc --device-link on objects compiled from srcs with --device-c.
  3456. ### This generates a stub object devlink.o that supplies missing pieces for the
  3457. ### host linker to link relocatable device objects into the final executable.
  3458. macro NVCC_DEVICE_LINK(Srcs...) {
  3459. .CMD=$NVCC $NVCC_FLAGS -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"} -dlink ${input;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:Srcs} ${kv;hide:"p DL"} ${kv;hide:"pc light-blue"}
  3460. }
  3461. # tag:flags
  3462. ### @usage: CYTHON_FLAGS(compiler_flags)
  3463. ### Add the specified flags to the compilation command of .pyx files.
  3464. macro CYTHON_FLAGS(Flags...) {
  3465. SET_APPEND(CYTHON_OPTIONS $Flags)
  3466. }
  3467. ### @usage: STRIP()
  3468. ### Strip debug info from a PROGRAM, DLL or TEST.
  3469. ### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's.
  3470. macro STRIP() {
  3471. ENABLE(STRIP)
  3472. }
  3473. ### @usage: NO_OPTIMIZE()
  3474. ### Build code without any optimizations (-O0 mode).
  3475. macro NO_OPTIMIZE() {
  3476. ENABLE(NO_OPTIMIZE)
  3477. }
  3478. #TODO(YMAKE-91) read proper compile flags instead of sending explicit flags to semgraph directly
  3479. _SEM_EXTRA_CXX_FLAGS=
  3480. ### @usage: NO_COMPILER_WARNINGS()
  3481. ### Disable all compiler warnings in the module.
  3482. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  3483. macro NO_COMPILER_WARNINGS() {
  3484. ENABLE(NO_COMPILER_WARNINGS)
  3485. SET(_SEM_EXTRA_CXX_FLAGS "$<IF:$<CXX_COMPILER_ID:MSVC>,,-Wno-everything>")
  3486. }
  3487. ### @usage: WERROR()
  3488. ### Consider warnings as errors in the current module.
  3489. ### In the bright future will be removed, since WERROR is the default.
  3490. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  3491. macro WERROR() {
  3492. ENABLE(WERROR)
  3493. }
  3494. ### @usage: NO_WERROR()
  3495. ### Override WERROR() behavior
  3496. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  3497. macro NO_WERROR() {
  3498. DISABLE(WERROR)
  3499. }
  3500. ### @usage: NO_WSHADOW()
  3501. ### Disable C++ shadowing warnings.
  3502. macro NO_WSHADOW() {
  3503. ENABLE(NO_WSHADOW)
  3504. }
  3505. # tag:internal
  3506. ### @usage: NO_PLATFORM_RESOURCES() # internal
  3507. ### Exclude dependency on platform resources libraries.
  3508. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  3509. macro NO_PLATFORM_RESOURCES() {
  3510. ENABLE(NOPLATFORM_RESOURCES)
  3511. }
  3512. # tag:internal tag:codenav
  3513. ### @usage: NO_CODENAVIGATION() # internal
  3514. ### Disable codenaviagtion for a module. Needed to avoid PEERDIR loops in codenavigation support.
  3515. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  3516. macro NO_CODENAVIGATION() {
  3517. ENABLE(NOCODENAVIGATION)
  3518. }
  3519. ### @usage: NO_UTIL()
  3520. ### Build module without dependency on util.
  3521. ### Note: use this with care. Util most likely will be linked into executable anyway,
  3522. ### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time.
  3523. macro NO_UTIL() {
  3524. ENABLE(NOUTIL)
  3525. }
  3526. ### @usage: NO_RUNTIME()
  3527. ###
  3528. ### This macro:
  3529. ### 1. Sets the ENABLE(NOUTIL) + DISABLE(USE_INTERNAL_STL);
  3530. ### 2. If the project that contains the macro NO_RUNTIME(), peerdir-it project does not contain NO_RUNTIME() => Warning.
  3531. ### Note: use this with care. Arcadia STL most likely will be linked into executable anyway, so using STL headers/functions/classes
  3532. ### may not be detected at build time and may lead to unpredictable behavors at configure time.
  3533. macro NO_RUNTIME() {
  3534. SET(USE_ARCADIA_LIBM no)
  3535. NO_UTIL()
  3536. ENABLE(NORUNTIME)
  3537. }
  3538. ### @usage: NO_LIBC()
  3539. ###
  3540. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata).
  3541. ### Note: use this with care. libc most likely will be linked into executable anyway,
  3542. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  3543. macro NO_LIBC() {
  3544. NO_RUNTIME()
  3545. DISABLE(MUSL)
  3546. }
  3547. ### @usage: NO_PLATFORM()
  3548. ###
  3549. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing.
  3550. ### Note: use this with care. libc most likely will be linked into executable anyway,
  3551. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  3552. macro NO_PLATFORM() {
  3553. NO_LIBC()
  3554. ENABLE(NOPLATFORM)
  3555. }
  3556. # tag:cpp-specific
  3557. ### @usage: USE_CXX()
  3558. ###
  3559. ### Add dependency on C++ runtime
  3560. ### Note: This macro is inteneded for use in _GO_BASE_UNIT like module when the module is built without C++ runtime by default
  3561. macro USE_CXX() {
  3562. DISABLE(NORUNTIME)
  3563. }
  3564. ### @usage: USE_UTIL()
  3565. ###
  3566. ### Add dependency on util and C++ runtime
  3567. ### Note: This macro is intended for use in _GO_BASE_UNIT like module when the module is build without util by default
  3568. macro USE_UTIL() {
  3569. USE_CXX()
  3570. DISABLE(NOUTIL)
  3571. }
  3572. ### @usage: USE_NASM()
  3573. ###
  3574. ### Build only .asm files with nasm toolchain instead of yasm
  3575. ### Add to ya.make file ADDINCL(asm ...) with all folders where .asm files include smth
  3576. macro USE_NASM() {
  3577. ENABLE(USE_NASM_ASSEMBLER)
  3578. PEERDIR(build/external_resources/nasm)
  3579. }
  3580. # tag:deprecated
  3581. ### @usage: NO_JOIN_SRC() # deprecated, does-nothing
  3582. ### This macro currently does nothing. This is default behavior which cannot be overridden at module level.
  3583. macro NO_JOIN_SRC() {
  3584. ENABLE(UNUSED_MACRO)
  3585. }
  3586. # tag:sanitize
  3587. ### @usage: NO_SANITIZE()
  3588. ###
  3589. ### Disable all sanitizers for the module.
  3590. macro NO_SANITIZE() {
  3591. DISABLE(SANITIZER_TYPE)
  3592. }
  3593. # tag:coverage tag:sanitize
  3594. ### @usage: NO_SANITIZE_COVERAGE()
  3595. ###
  3596. ### Disable lightweight coverage (-fsanitize-coverage) for the module.
  3597. ### Sanitize coverage is commonly used with fuzzing.
  3598. ### It might be useful to disable it for libraries that should never
  3599. ### be the main targets for fuzzing, like libfuzzer library itself.
  3600. ### Sanitize coverage instrumentation is enabled by the --sanitize-coverage option.
  3601. macro NO_SANITIZE_COVERAGE() {
  3602. DISABLE(SANITIZE_COVERAGE)
  3603. }
  3604. # tag:coverage
  3605. ### @usage: NO_CLANG_COVERAGE()
  3606. ###
  3607. ### Disable heavyweight clang coverage for the module. Clang coverage instrumentation is enabled by the --clang-coverage option.
  3608. macro NO_CLANG_COVERAGE() {
  3609. DISABLE(CLANG_COVERAGE)
  3610. }
  3611. macro NO_CLANG_TIDY() {
  3612. DISABLE(TIDY_ENABLED)
  3613. }
  3614. # tag:lua-specific
  3615. LUAJIT_PATH=${ARCADIA_ROOT}/contrib/libs/luajit
  3616. macro _LUAJIT_OBJDUMP(Src, OUT="") {
  3617. .CMD=${cwd:LUAJIT_PATH} ${tool:"contrib/libs/luajit/compiler"} -b -g ${input:Src} ${output;noauto:OUT} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  3618. }
  3619. # tag:lua-specific
  3620. LUAJIT_21_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_21
  3621. macro _LUAJIT_21_OBJDUMP(Src, OUT="") {
  3622. .CMD=${cwd:LUAJIT_21_PATH} ${tool:"contrib/libs/luajit_21/compiler"} -b -g ${input:Src} ${output;noauto:OUT} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  3623. }
  3624. # tag:lua-specific
  3625. LUAJIT_OPENRESTY_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_openresty
  3626. macro _LUAJIT_OPENRESTY_OBJDUMP(Src, OUT="") {
  3627. .CMD=${cwd:LUAJIT_OPENRESTY_PATH} ${tool:"contrib/libs/luajit_openresty/compiler"} -b -g ${input:Src} ${output;noauto:OUT} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  3628. }
  3629. macro _MX_BIN_TO_INFO(Src) {
  3630. .CMD=${tool:"tools/mx_bin2info"} ${input:Src} ${output;nopath;noext;noauto:Src.info} ${kv;hide:"p MX"} ${kv;hide:"pc yellow"}
  3631. }
  3632. MX_GEN_TABLE_INCLS=${output_include;hide:"yabs_mx_calc_table.h"} \
  3633. ${output_include;hide:"kernel/matrixnet/mn_sse.h"} \
  3634. ${output_include;hide:"library/cpp/archive/yarchive.h"} \
  3635. ${output_include;hide:"util/memory/blob.h"} \
  3636. ${output_include;hide:"util/generic/hash.h"} \
  3637. ${output_include;hide:"util/generic/ptr.h"} \
  3638. ${output_include;hide:"util/generic/singleton.h"}
  3639. macro _MX_GEN_TABLE(Srcs...) {
  3640. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_mx_table.py"} $Srcs ${output;stdout:"mx_tables.cpp"} $MX_GEN_TABLE_INCLS ${kv;hide:"p MX"} ${kv;hide:"pc yellow"}
  3641. PEERDIR(kernel/matrixnet)
  3642. PEERDIR(library/cpp/archive)
  3643. }
  3644. RELEV_FML_CODEGEN_INCLS=${output_include;hide:"kernel/relevfml/relev_fml.h"} ${output_include;hide:"library/cpp/sse/sse.h"}
  3645. ### @usage: GENERATE_ENUM_SERIALIZATION(File.h)
  3646. ###
  3647. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module.
  3648. ###
  3649. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  3650. macro GENERATE_ENUM_SERIALIZATION(File) {
  3651. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} ${output_include;from_input;hide:File} ${output_include;hide:"util/generic/serialized_enum.h"} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  3652. .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser"}
  3653. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  3654. }
  3655. ### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h)
  3656. ###
  3657. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module
  3658. ### Provide access to serialization functions via generated header File_serialized.h
  3659. ###
  3660. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  3661. macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) {
  3662. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} --header ${output;suf=_serialized.h:File} ${output_include;from_input;hide:File} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  3663. .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} GEN_HEADER ${output;suf=_serialized.h:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser"}
  3664. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  3665. }
  3666. ### @usage: DEB_VERSION(File)
  3667. ###
  3668. ### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File.
  3669. macro DEB_VERSION(File) {
  3670. .CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${output;stdout:"DebianVersion.h"} ${kv;hide:"p CL"} ${kv;hide:"pc yellow"}
  3671. }
  3672. BUILD_MN_SCRIPT=build/scripts/build_mn.py
  3673. # tag:matrixnet
  3674. ### @usage: BUILD_MN([CHECK] [PTR] [MULTI] mninfo mnname) # matrixnet
  3675. ###
  3676. ### Generate MatrixNet data and access code using single command.
  3677. ### Alternative macro BUILD_MNS() works faster and better for large files.
  3678. macro BUILD_MN(MnInfo, MnName, CHECK?"fml_tool=$FML_UNUSED_TOOL CHECK":"", MULTI?, PTR?, RANKING_SUFFIX="") {
  3679. .CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnF $ARCADIA_ROOT $ARCH_TOOL ${input:MnInfo} $MnName ranking_suffix=$RANKING_SUFFIX ${output;pre=mn.:MnName.cpp} ${output;hide;pre=MN_External_;suf=.rodata:MnName} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} $CHECK $MULTI $PTR ${kv;hide:"p MN"} ${kv;hide:"pc yellow"}
  3680. }
  3681. macro _BUILD_MNS_FILE(Input, Name, Output, Suffix, Check, Fml_tool, AsmDataName) {
  3682. .CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnsFilesF $ARCADIA_ROOT $BINDIR $ARCH_TOOL fml_tool=$Fml_tool $Name ranking_suffix=$Suffix ${input:Input} ${output;hide:Output} ${output;hide;pre=MN_External_;suf=.rodata:AsmDataName} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} ${kv;hide:"p MN"} ${kv;hide:"pc yellow"}
  3683. }
  3684. MNS_OUTPUT=mnmodels
  3685. macro _BUILD_MNS_CPP(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  3686. .CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnsCppF $NAME ranking_suffix=$RANKING_SUFFIX ${input:MNS_OUTPUT.h} ${output:MNS_OUTPUT.cpp} ${input:Files} ${output_include;hide:MNS_OUTPUT.h} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} ${kv;hide:"p MN"} ${kv;hide:"pc yellow"}
  3687. }
  3688. macro _BUILD_MNS_HEADER(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  3689. .CMD=$YMAKE_PYTHON ${input:BUILD_MN_SCRIPT} BuildMnsHeaderF $NAME ranking_suffix=$RANKING_SUFFIX ${output:MNS_OUTPUT.h} ${input:Files} ${output_include;hide:"kernel/matrixnet/mn_sse.h"} ${output_include;hide:"kernel/matrixnet/mn_multi_categ.h"} ${kv;hide:"p MN"} ${kv;hide:"pc yellow"}
  3690. }
  3691. # TODO: support foreach_in and keywords simultaneous usage (look at BUILD_MNS_FILES)
  3692. # tag:matrixnet
  3693. ### @usage: BUILD_MNS([CHECK] NAME listname mninfos...) # matrixnet
  3694. ###
  3695. ### Generate MatrixNet data and access code using separate commands for support code, interface and data.
  3696. ### Faster version of BUILD_MN() macro for large files.
  3697. macro BUILD_MNS(Files...) {
  3698. _BUILD_MNS_HEADER($Files)
  3699. _BUILD_MNS_CPP($Files)
  3700. _BUILD_MNS_FILES($Files)
  3701. }
  3702. ### @usage: NEED_CHECK()
  3703. ###
  3704. ### Commits to the project marked with this macro will be blocked by pre-commit check and then will be
  3705. ### automatically merged to trunk only if there is no new broken build targets in check results.
  3706. ### The use of this macro is disabled by default.
  3707. macro NEED_CHECK(Flags...) {
  3708. # TODO: FIXME
  3709. ENABLE(UNUSED_MACRO)
  3710. }
  3711. ### @usage: NO_NEED_CHECK()
  3712. ###
  3713. ### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro.
  3714. macro NO_NEED_CHECK(Flags...) {
  3715. ENABLE(UNUSED_MACRO)
  3716. }
  3717. # tag:deprecated
  3718. ### @usage: NEED_REVIEW() # deprecated
  3719. ###
  3720. ### Mark the project as needing review.
  3721. ### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default.
  3722. ### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104
  3723. macro NEED_REVIEW(Flags...) {
  3724. # TODO: FIXME
  3725. ENABLE(UNUSED_MACRO)
  3726. }
  3727. ### @usage: VERSION(Args...)
  3728. ###
  3729. ### Specify version of a module. Currently unused by build system, only informative.
  3730. macro VERSION(Flags...) {
  3731. ENABLE(UNUSED_MACRO)
  3732. }
  3733. DATAWORK_SCHEEME_EXPORT_FLAGS=
  3734. when ($UNIX == "yes") {
  3735. SCHEEME2_CFLAGS= -E -x c++
  3736. }
  3737. when ($WIN32 == "yes") {
  3738. SCHEEME2_CFLAGS= /E /TP
  3739. }
  3740. SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc44_no_typename --no_complex_overloaded_func_export
  3741. ### @usage: GEN_SCHEEME2(scheeme_name from_file dependent_files...)
  3742. ###
  3743. ### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected).
  3744. ###
  3745. ### 1. ${scheeme_name}.inc - the name of the generated file.
  3746. ### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser
  3747. ###
  3748. ### @example:
  3749. ###
  3750. ### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::")
  3751. ###
  3752. ### all options are passed to structparser (in this example --final_only - do not export heirs with public base that contains the required field,,- m "::" only from the root namespace)
  3753. ### sets in extra option
  3754. ###
  3755. ### @example:
  3756. ###
  3757. ### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
  3758. ### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
  3759. ### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
  3760. ###
  3761. ### for compatibility with C++ compiler and the external environment.
  3762. ### See tools/structparser for more details.
  3763. macro GEN_SCHEEME2(ScheemeName, FromFile) {
  3764. .CMD=$CXX_COMPILER $C_FLAGS_PLATFORM -c ${tmp;stdout:FromFile.cph} $SCHEEME2_CFLAGS ${input:FromFile} ${pre=-I:_C__INCLUDE} $CXXFLAGS -Wno-error && ${tool:"tools/structparser"} -o ${output:ScheemeName.inc} -n N${ScheemeName}SchemeInfo $SCHEEME2_STRUCT_INFO_FLAGS $DATAWORK_SCHEEME_EXPORT_FLAGS ${tmp:FromFile.cph} ${output;stdout;noauto:ScheemeName.inc.log} ${kv;hide:"p SH"} ${kv;hide:"pc yellow"}
  3765. }
  3766. ### @usage: SYMLINK(from to)
  3767. ### Add symlink
  3768. macro SYMLINK(From, To) {
  3769. .CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${output;noauto:To} ${kv;hide:"p LN"} ${kv;hide:"pc light-cyan"}
  3770. }
  3771. # tag:internal
  3772. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  3773. ### Generate prefix " && target_sources PRIVATE " before $Args when GENERATE is specified in the list of actual arguments
  3774. macro _TARGET_SOURCES_FOR_HEADERS_IMPL(GENERATE?" && target_sources PRIVATE ":"", Args...) {
  3775. .SEM=$GENERATE ${output;ext=.h:Args} ${output;ext=.hh:Args} ${output;ext=.hpp:Args} ${output;ext=.inc:Args} ${output;ext=.i:Args}
  3776. }
  3777. # tag:internal
  3778. ### @usage: _TARGET_SOURCES_FOR_HEADERS(Args...) # internal
  3779. ### Generate prefix " && target_sources PRIVATE " before $Args if Args is not empty
  3780. macro _TARGET_SOURCES_FOR_HEADERS(Args...) {
  3781. .SEM=$_TARGET_SOURCES_FOR_HEADERS_IMPL(${pre=GENERATE :Args})
  3782. }
  3783. # tag:internal
  3784. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  3785. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args when GENERATE is specified in the list of actual arguments
  3786. macro _SET_ENV_FOR_CUSTOM_COMMAND_IMPL(GENERATE?" ${CMAKE_COMMAND} -E env ":"", Args...) {
  3787. .SEM=$GENERATE ${pre= :Args}
  3788. }
  3789. # tag:internal
  3790. ### @usage: _SET_ENV_FOR_CUSTOM_COMMAND(Args...) # internal
  3791. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args if Args is not empty
  3792. macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
  3793. .SEM=$_SET_ENV_FOR_CUSTOM_COMMAND_IMPL(${pre=GENERATE :Args})
  3794. }
  3795. macro _FMT_INDUCED_DEPS(For, Deps...) {
  3796. .CMD=${induced_deps=$For;hide:Deps}
  3797. }
  3798. ### @usage: PREPARE_INDUCED_DEPS(VAR Type Files...)
  3799. ###
  3800. ### Format value for `INDUCED_DEPS` param in certain macros and assign to `VAR`
  3801. ### This tells that files of Type resulted from code generation macros (not neccessarily directly,
  3802. ### but in processing chain of generated files) should have extra dependencies from list of Files...
  3803. ###
  3804. ### Prominent example here is Cython: one can generate .pyx file that may depend on .pxd and have cimpot from
  3805. ### certain .h. The former is dependency for .pyx itself, while the latter is dependency for .pyx.cpp
  3806. ### resulted from Cython-processing of generated pyx. The code ganeration will look like:
  3807. ### ```
  3808. ### PREPARE_INDUCED_DEPS(PYX_DEPS pyx imported.pxd)
  3809. ### PREPARE_INDUCED_DEPS(CPP_DEPS cpp cdefed.h)
  3810. ### RUN_PYTHON3(generate_pyx.py genereted.pyx OUT generated.pyx INDUCED_DEPS $PYX_DEPS $CPP_DEPS)
  3811. ### ```
  3812. ###
  3813. ### The VAR will basically contain pair of `Type:[Files...]` in a form suitable for passing
  3814. ### as an element of array parameter. This is needed because language of ya.make doesn't support
  3815. ### Dict params right now and so it is impossible to directly pass something
  3816. ### like `{Type1:[Files2...], Type2:[Files2...]}`
  3817. ###
  3818. macro PREPARE_INDUCED_DEPS(VAR, For, Deps...) {
  3819. SET($VAR \$_FMT_INDUCED_DEPS($For $Deps))
  3820. }
  3821. ### @usage: RUN_PROGRAM(tool_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  3822. ###
  3823. ### Run a program from arcadia.
  3824. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  3825. ###
  3826. ### Parameters:
  3827. ### - tool_path - Path to the directory of the tool.
  3828. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  3829. ### - CWD dir - Absolute path of the working directory.
  3830. ### - ENV key=value... - Environment variables.
  3831. ### - TOOL tools... - Auxiliary tool directories.
  3832. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  3833. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  3834. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  3835. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  3836. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  3837. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  3838. ###
  3839. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  3840. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  3841. ### Note that Tool is always built for the host platform, so be careful to provide that tool can be built for all Arcadia major host platforms (Linux, MacOS and Windows).
  3842. macro RUN_PROGRAM(Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  3843. .CMD=${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3844. .SEM=add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${tool:Tool} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND ${tool:Tool} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  3845. }
  3846. # tag:lua-specific
  3847. ### @usage: RUN_LUA(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  3848. ###
  3849. ### Run a lua script.
  3850. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  3851. ###
  3852. ### Parameters:
  3853. ### - script_path - Path to the script.3
  3854. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  3855. ### - CWD dir - Absolute path of the working directory.
  3856. ### - ENV key=value... - Environment variables.
  3857. ### - TOOL tools... - Auxiliary tool directories.
  3858. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  3859. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  3860. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  3861. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  3862. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  3863. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  3864. ###
  3865. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  3866. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  3867. macro RUN_LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  3868. .CMD=${cwd:CWD} ${env:ENV} $LUA_TOOL ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p LU"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3869. }
  3870. # tag:python-specific
  3871. ### @usage: PYTHON(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  3872. ###
  3873. ### Run a python script with $(PYTHON)/python built from devtools/huge_python.
  3874. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  3875. ###
  3876. ### Parameters:
  3877. ### - script_path - Path to the script.
  3878. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  3879. ### - CWD dir - Absolute path of the working directory.
  3880. ### - ENV key=value... - Environment variables.
  3881. ### - TOOL tools... - Auxiliary tool directories.
  3882. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  3883. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  3884. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  3885. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  3886. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  3887. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  3888. ###
  3889. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  3890. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  3891. macro PYTHON(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  3892. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3893. .SEM=find_package Python2 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python2::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  3894. }
  3895. # tag:python-specific
  3896. ### @usage: RUN_PYTHON3(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  3897. ###
  3898. ### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3.
  3899. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  3900. ###
  3901. ### Parameters:
  3902. ### - script_path - Path to the script.
  3903. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  3904. ### - CWD dir - Absolute path of the working directory.
  3905. ### - ENV key=value... - Environment variables.
  3906. ### - TOOL tools... - Auxiliary tool directories.
  3907. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  3908. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  3909. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  3910. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  3911. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  3912. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  3913. ###
  3914. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  3915. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  3916. macro RUN_PYTHON3(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  3917. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON3 ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3918. .SEM=find_package Python3 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python3::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  3919. }
  3920. # tag:java-specific
  3921. macro _RUN_JAVA(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", Args...) {
  3922. PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  3923. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input;pre=build/scripts/:HIDE_OUTPUT.py} $JDK_RESOURCE/bin/java $Args ${tool;hide:TOOL} ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  3924. }
  3925. ### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  3926. ###
  3927. ### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable.
  3928. ### You may specify extra dependencies that output files bring using OUTPUT_INCLUDES or INDUCED_DEPS. The change of these may e.g. lead to recompilation of .cpp files extracted from resource.
  3929. ### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT.
  3930. ###
  3931. ### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system.
  3932. ###
  3933. ### RENAME renames files to the corresponding OUT and OUT_NOAUTO outputs:
  3934. ### FROM_SANDBOX(resource_id RENAME in_file1 in_file2 OUT out_file1 out_file2 out_file3)
  3935. ### FROM_SANDBOX(resource_id RENAME in_file1 OUT out_file1 RENAME in_file2 OUT out_file2)
  3936. ### FROM_SANDBOX(FILE resource_id RENAME resource_file OUT out_name)
  3937. ###
  3938. ### RENAME RESOURCE allows to rename the resource without specifying its file name.
  3939. ###
  3940. ### OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  3941. ### INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  3942. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  3943. ###
  3944. ### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and
  3945. ### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position,
  3946. ### so you shall place it immediately after resource_id.
  3947. macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", SBR="sbr:") {
  3948. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3949. ADD_CHECK(check.resource $Id)
  3950. }
  3951. ### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  3952. ###
  3953. ### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  3954. macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  3955. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_mds.py"} --key $Key $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p MD"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3956. ADD_CHECK(check.mds $Key)
  3957. }
  3958. # tag:internal
  3959. ### @usage: _FROM_EXTERNAL(ExtFile [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) #internal
  3960. ###
  3961. ### Use resource described as .external file as [FROM_SANDBOX()](#macro_FROM_SANDBOX)/[FROM_MDS()](#macro_FROM_MDS).
  3962. macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") {
  3963. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$EXT;suf=.external:OutFile} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_external.py"} --external-file ${input:File} --resource-file $(RESOURCE_ROOT)/ext/$OutFile --copy-to-dir $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${input;hide:"build/scripts/fetch_from_sandbox.py"} ${input;hide:"build/scripts/fetch_from_mds.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p XT"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3964. #FIXME: add '${resource;pre=$EXT:OutFile}' when support of the scheme is added to executors
  3965. #FIXME: add 'ADD_CHECK(check.external $File)' when proper testing is implemented
  3966. }
  3967. ### @usage LARGE_FILES([AUTOUPDATED] Files...)
  3968. ###
  3969. ### Use large file ether from working copy or from remote storage via placeholder <File>.external
  3970. ### If <File> is present locally (and not a symlink!) it will be copied to build directory.
  3971. ### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
  3972. macro LARGE_FILES(AUTOUPDATED?, Files...) {
  3973. # This is needed to correctly switch between remote and local modes
  3974. _GLOB($LF $Files)
  3975. }
  3976. ### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  3977. ###
  3978. ### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  3979. macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  3980. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_archive.py"} "--archive" ${input:Src} "--file-name" ${suf=-:Src} "--untar-to" $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${kv;hide:"p FA"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3981. }
  3982. when ($MSVC == "yes") {
  3983. C_AS_CXX_FLAGS=/TP /std:c++17
  3984. }
  3985. otherwise {
  3986. C_AS_CXX_FLAGS=-x c++ -std=c++17
  3987. }
  3988. # tag:cpp-specific
  3989. ### @usage: COMPILE_C_AS_CXX()
  3990. ###
  3991. ### Compile .c files as .cpp ones within a module.
  3992. macro COMPILE_C_AS_CXX() {
  3993. SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS)
  3994. }
  3995. ### @usage: NO_DEBUG_INFO()
  3996. ###
  3997. ### Compile files without debug info collection.
  3998. macro NO_DEBUG_INFO() {
  3999. SET(NO_DEBUGINFO yes)
  4000. }
  4001. ### @usage: CTEMPLATE_VARNAMES(File)
  4002. ###
  4003. ### Generate File.varnames.h using contrib/libs/ctemplate/make_tpl_varnames_h
  4004. ###
  4005. ### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md
  4006. macro CTEMPLATE_VARNAMES(File) {
  4007. .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${output;addincl;nopath;noallext:File.varnames.h} ${input:File}
  4008. }
  4009. LLVM_OPTS=
  4010. CLANG_BC_ROOT=${CLANG11_RESOURCE_GLOBAL}
  4011. macro USE_LLVM_BC12() {
  4012. SET(CLANG_BC_ROOT ${CLANG12_RESOURCE_GLOBAL})
  4013. }
  4014. macro USE_LLVM_BC14() {
  4015. SET(CLANG_BC_ROOT ${CLANG14_RESOURCE_GLOBAL})
  4016. }
  4017. macro USE_LLVM_BC16() {
  4018. SET(CLANG_BC_ROOT ${CLANG16_RESOURCE_GLOBAL})
  4019. }
  4020. CLANG_DEFAULT_ROOT=${CLANG_RESOURCE_GLOBAL}
  4021. CLANG_C_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang
  4022. CLANG_CPP_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang++
  4023. CLANG_EMIT_EXTRA_OPTS=
  4024. when ($OS_WINDOWS == "yes") {
  4025. # we can't use c++latest for clang14 now
  4026. # so we set c++20 for it
  4027. # for clang11 (actual clang for CLANG_EMIT_AST_CXX and LLVM_COMPILE_* macroses) /std:c++20 provokes "unused-command-line-argument" error
  4028. # !do not forget to change this flag when updating build/platform/clang
  4029. CLANG_EMIT_EXTRA_OPTS+=/std:c++latest
  4030. }
  4031. when ($OS_ANDROID == "yes") {
  4032. # We use clang shipped with android-ndk which has different layout
  4033. CLANG_DEFAULT_ROOT=$CLANG_ANDROID_RESOURCE_GLOBAL
  4034. when ($HOST_OS_DARWIN) {
  4035. CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
  4036. CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
  4037. }
  4038. otherwise {
  4039. CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
  4040. CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
  4041. }
  4042. }
  4043. ### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...)
  4044. ###
  4045. ### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not.
  4046. ### Note: Output name is used as is, no extension added.
  4047. macro CLANG_EMIT_AST_CXX(Input, Output, Opts...) {
  4048. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_CPP_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS -emit-ast -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p ST"} ${kv;hide:"pc light-green"}
  4049. PEERDIR(build/platform/clang)
  4050. }
  4051. ### @usage: LLVM_COMPILE_CXX(Input Output Opts...)
  4052. ###
  4053. ### Emit LLVM bytecode from .cpp file. BC_CXXFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  4054. ### Note: Output name is used as is, no extension added.
  4055. macro LLVM_COMPILE_CXX(Input, Output, Opts...) {
  4056. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang++ ${pre=-I:_C__INCLUDE} $BC_CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  4057. .SEM=llvm_compile_cxx ${input:Input} ${output;noauto:Output} ${"${CLANGPLUSPLUS}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  4058. PEERDIR(build/platform/clang)
  4059. }
  4060. ### @usage: LLVM_COMPILE_C(Input Output Opts...)
  4061. ###
  4062. ### Emit LLVM bytecode from .c file. BC_CFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  4063. ### Note: Output name is used as is, no extension added.
  4064. macro LLVM_COMPILE_C(Input, Output, Opts...) {
  4065. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang ${pre=-I:_C__INCLUDE} $BC_CFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  4066. .SEM=llvm_compile_c ${input:Input} ${output;noauto:Output} ${"${CLANGC}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  4067. PEERDIR(build/platform/clang)
  4068. }
  4069. ### @usage: BPF(Input Output Opts...)
  4070. ###
  4071. ### Emit eBPF bytecode from .c file.
  4072. ### Note: Output name is used as is, no extension added.
  4073. macro BPF(Input, Output, Opts...) {
  4074. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_C_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BP"} ${kv;hide:"pc light-green"}
  4075. PEERDIR(build/platform/clang)
  4076. }
  4077. LD_BINARY_NAME=ld
  4078. when($OS_LINUX) {
  4079. LD_BINARY_NAME=ld.lld
  4080. }
  4081. ### @usage: BPF_STATIC(Input Output Opts...)
  4082. ###
  4083. ### Emit eBPF bytecode from .c file.
  4084. ### Note: Output name is used as is, no extension added.
  4085. macro BPF_STATIC(Input, Output, Opts...) {
  4086. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_C_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BP"} ${kv;hide:"pc light-green"} && ${cwd:BINDIR} $LLD_ROOT_RESOURCE_GLOBAL/$LD_BINARY_NAME -r -b binary -m elf_x86_64 -o ${output;noauto;suf=.bpf.o:Input} ${noauto;nopath:Output}
  4087. PEERDIR(build/platform/clang build/platform/lld)
  4088. }
  4089. ### @usage: LLVM_COMPILE_LL(Input Output Opts...)
  4090. ###
  4091. ### Compile LLVM bytecode to object representation.
  4092. ### Note: Output name is used as is, no extension added.
  4093. macro LLVM_COMPILE_LL(Input, Output, Opts...) {
  4094. .CMD=${CLANG_BC_ROOT}/bin/llvm-as ${input:Input} -o ${output;noauto:Output} ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  4095. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMAS} ${input:Input} -o ${output;noauto:Output}
  4096. PEERDIR(build/platform/clang)
  4097. }
  4098. ### @usage: LLVM_LINK(Output Inputs...)
  4099. ###
  4100. ### Call llvm-link on set of Inputs to produce Output.
  4101. ### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
  4102. macro LLVM_LINK(Output, Inputs...) {
  4103. .CMD=${CLANG_BC_ROOT}/bin/llvm-link ${input:Inputs} -o ${output;noauto:Output} ${kv;hide:"p LD"} ${kv;hide:"pc light-red"}
  4104. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Inputs} COMMAND ${LLVMLINK} ${input:Inputs} -o ${output;noauto:Output}
  4105. PEERDIR(build/platform/clang)
  4106. }
  4107. ### @usage: LLVM_OPT(Input Output Opts...)
  4108. ###
  4109. ### Call llvm-opt with set of Opts on Input to produce Output.
  4110. ### Note: Output name is used as is, no extension added.
  4111. macro LLVM_OPT(Input, Output, Opts...) {
  4112. .CMD=$YMAKE_PYTHON ${input:"build/scripts/llvm_opt_wrapper.py"} ${CLANG_BC_ROOT}/bin/opt ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p OP"} ${kv;hide:"pc yellow"}
  4113. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMOPT} ${input:Input} -o ${output;noauto:Output} $Opts
  4114. PEERDIR(build/platform/clang)
  4115. }
  4116. ### @usage: LLVM_LLC(Src Opts...)
  4117. ###
  4118. ### Call llvm-llc with set of Opts on Src to produce object file.
  4119. ###
  4120. ### Note: Output name is calculated as concatenation of Src name and platform specific object file extension.
  4121. macro LLVM_LLC(Src, Opts...) {
  4122. .CMD=${tool:"contrib/libs/llvm14/tools/llc"} ${input:Src} --filetype obj -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts ${kv;hide:"p LC"} ${kv;hide:"pc yellow"}
  4123. .SEM=add_custom_command OUTPUT ${output;suf=$OBJECT_SUF;noauto:Src} DEPENDS ${input:Src} COMMAND ${LLVMLLC} --filetype obj ${input:Src} -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts
  4124. PEERDIR(build/platform/clang)
  4125. }
  4126. when ($NO_DEBUGINFO == "yes") {
  4127. DEBUG_INFO_FLAGS=
  4128. }
  4129. when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") {
  4130. DEBUG_INFO_FLAGS=-gline-tables-only
  4131. }
  4132. # TODO: configurable tar and touch
  4133. PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  4134. # tag:internal
  4135. ### @usage TOUCH(Outputs...) # internal
  4136. ### Just introduce outputs
  4137. macro TOUCH(Outputs...) {
  4138. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
  4139. }
  4140. TOUCH_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"p UN"} ${kv;hide:"pc light-cyan"} $TARGET
  4141. FAKE_PACKAGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"pc light-red"} $TARGET
  4142. COPY_PACKAGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/copy_to_dir.py"} --dest-dir $BINDIR --build-root $ARCADIA_BUILD_ROOT $PACKED_PACKAGE_ARGS $SRCS_GLOBAL $PEERS_LATE_OUTS ${skip_by_ext=.pkg.fake:PEERS} ${hide;late_out:AUTO_INPUT} ${hide;late_out;to_namespace=$BINDIR/:SRCS_GLOBAL} ${hide;late_out;to_namespace=$BINDIR/:PEERS_LATE_OUTS} ${hide;late_out;skip_by_ext=.pkg.fake;to_namespace=$BINDIR/:PEERS} ${kv;hide:"package PACKAGE"}
  4143. TOUCH_PACKAGE=$FAKE_PACKAGE_CMD $VCS_INFO_DISABLE_CACHE__NO_UID__ && $COPY_PACKAGE_CMD
  4144. _P_PK=${kv;hide:"p PK"}
  4145. TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK && $ADD_VCS_INFO_FILE_CMD
  4146. # Note: we don't use touch.py in the command below to avoid introduction of undesired input
  4147. UNION_CMD=$YMAKE_PYTHON -c open(\'$TARGET\',\'w\').close() ${kv;hide:"p UN"} ${kv;hide:"package UNION"} ${kv;hide:"pc light-cyan"} $UNION_OUTS $VCS_INFO_DISABLE_CACHE__NO_UID__
  4148. UNION_CMD_MF=$UNION_CMD && $GENERATE_MF
  4149. macro _EXPAND_INS_OUTS(FILES{input}[]) {
  4150. .CMD=${input;hide:FILES} ${late_out;hide:INPUT}
  4151. }
  4152. _UNION_EXPLICIT_OUTPUTS=
  4153. ### @usage: EXPLICIT_OUTPUTS(Files...)
  4154. ###
  4155. ### Let UNION has only explicitly specified outputs listed in this macro
  4156. ### The list of files shall contain results of commands in this UNION.
  4157. ### Only these files will be outputs of the UNION. This allows to eliminate
  4158. ### intermediate files being result of the UNION
  4159. macro EXPLICIT_OUTPUTS(Files...) {
  4160. SET_APPEND(_UNION_EXPLICIT_OUTPUTS ${Files})
  4161. }
  4162. NO_CHECK_IMPORTS_FOR_VALUE=None
  4163. ### @usage: NO_CHECK_IMPORTS([patterns])
  4164. ###
  4165. ### Do not run checks on imports of Python modules.
  4166. ### Optional parameter mask patterns describes the names of the modules that do not need to check.
  4167. macro NO_CHECK_IMPORTS(Masks...) {
  4168. SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks)
  4169. }
  4170. # tag:yasm-specific
  4171. _YASM_FMT_VALUE=
  4172. _YASM_PLATFORM_FLAGS_VALUE=
  4173. _YASM_PREDEFINED_FLAGS_VALUE=
  4174. when ($OS_DARWIN || $OS_IOS) {
  4175. _YASM_FMT_VALUE=macho
  4176. _YASM_PLATFORM_FLAGS_VALUE=-D DARWIN -D UNIX
  4177. }
  4178. elsewhen ($OS_WINDOWS && $ARCH_X86_64) {
  4179. _YASM_FMT_VALUE=win
  4180. _YASM_PLATFORM_FLAGS_VALUE=-D WIN64
  4181. }
  4182. elsewhen ($OS_WINDOWS && $ARCH_I386) {
  4183. _YASM_FMT_VALUE=win
  4184. _YASM_PLATFORM_FLAGS_VALUE=-D WIN32
  4185. }
  4186. otherwise {
  4187. _YASM_FMT_VALUE=elf
  4188. _YASM_PLATFORM_FLAGS_VALUE=-D UNIX
  4189. _YASM_PREDEFINED_FLAGS_VALUE=-g dwarf2
  4190. }
  4191. when ($ASM_PREFIX) {
  4192. ASM_PREFIX_VALUE=--prefix=$ASM_PREFIX
  4193. }
  4194. otherwise {
  4195. ASM_PREFIX_VALUE=
  4196. }
  4197. # tag:yasm-specific
  4198. YASM_FLAGS=
  4199. YASM_PREINCLUDES_VALUE=
  4200. # tag:yasm-specific
  4201. macro _SRC_yasm_helper(SRC, PREINCLUDES[], SRCFLAGS...) {
  4202. .CMD=${tool:"contrib/tools/yasm"} -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE $YASM_DEBUG_INFO $YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__ -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${pre=-P :PREINCLUDES} ${input;hide:PREINCLUDES} ${SRC} ${kv;hide:"p AS"} ${kv;hide:"pc light-green"}
  4203. }
  4204. # tag:yasm-specific
  4205. macro _SRC_yasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  4206. .CMD=$_SRC_yasm_helper(${input:SRC}, $SRCFLAGS, PREINCLUDES $PREINCLUDES)
  4207. }
  4208. # tag:nasm-specific
  4209. NASM_FLAGS=
  4210. # tag:nasm-specific
  4211. macro _SRC_nasm_helper(SRC, SRCFLAGS...) {
  4212. .CMD=${NASM_RESOURCE_GLOBAL}/bin/nasm -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} -D ${pre=_;suf=_:HARDWARE_TYPE} $NASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${SRC}
  4213. }
  4214. # tag:nasm-specific
  4215. macro _SRC_nasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  4216. .CMD=$_SRC_nasm_helper(${input:SRC}, $SRCFLAGS)
  4217. }
  4218. # tag:src-processing
  4219. when ($USE_NASM_ASSEMBLER == "yes") {
  4220. _SRC_ASM_CMDLINE=$_SRC_nasm($SRC $SRCFLAGS)
  4221. }
  4222. otherwise {
  4223. _SRC_ASM_CMDLINE=$_SRC_yasm($SRC $SRCFLAGS)
  4224. }
  4225. # tag:src-processing
  4226. macro _SRC_ASM(SRC, SRCFLAGS...) {
  4227. .CMD=$_SRC_ASM_CMDLINE
  4228. }
  4229. ### @usage: ASM_PREINCLUDE(AsmFiles...)
  4230. ###
  4231. ### Supply additional .asm files to all assembler calls within a module
  4232. macro ASM_PREINCLUDE(PREINCLUDES...) {
  4233. SET_APPEND(YASM_PREINCLUDES_VALUE $PREINCLUDES)
  4234. }
  4235. ### @usage: RUN_ANTLR(Args...)
  4236. ###
  4237. ### Macro to invoke ANTLR3 generator (general case)
  4238. macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  4239. _RUN_JAVA(-jar ${input:"contrib/java/antlr/antlr3/antlr.jar"} $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
  4240. .SEM=run_antlr OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} DEPENDS ${input:IN} ${pre=WORKING_DIRECTORY :CWD} ANTLER_ARGS $Args
  4241. }
  4242. ### @usage: RUN_ANTLR4(Args...)
  4243. ###
  4244. ### Macro to invoke ANTLR4 generator (general case)
  4245. macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  4246. _RUN_JAVA(-jar ${input:"contrib/java/antlr/antlr4/antlr.jar"} $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
  4247. }
  4248. _ANTLR4_LISTENER_GRAMMAR=-listener
  4249. _ANTLR4_LISTENER_PARSER=-listener
  4250. _ANTLR4_LISTENER__ANTLR4_EMPTY=-no-listener
  4251. _ANTLR4_VISITOR_GRAMMAR=-visitor
  4252. _ANTLR4_VISITOR_PARSER=-visitor
  4253. _ANTLR4_VISITOR__ANTLR4_EMPTY=-no-visitor
  4254. ### @usage: RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  4255. ###
  4256. ### Macro to invoke ANTLR4 generator for separate lexer and parser grammars (Cpp)
  4257. macro RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES[], LISTENER?"PARSER":"_ANTLR4_EMPTY", VISITOR?"PARSER":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  4258. RUN_ANTLR4(${LEXER} ${PARSER} -Dlanguage=Cpp -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${LEXER} ${PARSER} OUT ${noext;suf=.cpp:LEXER} ${noext;suf=.h:LEXER} ${noext;suf=.cpp:PARSER} ${noext;suf=.h:PARSER} ${noext;suf=Listener.h:$LISTENER} ${noext;suf=BaseListener.h:$LISTENER} ${noext;suf=Visitor.h:$VISITOR} ${noext;suf=BaseVisitor.h:$VISITOR} OUTPUT_INCLUDES ${ARCADIA_ROOT}/contrib/libs/antlr4_cpp_runtime/src/antlr4-runtime.h ${OUTPUT_INCLUDES})
  4259. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  4260. }
  4261. ### @usage: RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  4262. ###
  4263. ### Macro to invoke ANTLR4 generator for combined lexer+parser grammars (Cpp)
  4264. macro RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  4265. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Cpp -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;suf=Lexer.cpp:GRAMMAR} ${noext;suf=Lexer.h:GRAMMAR} ${noext;suf=Parser.cpp:GRAMMAR} ${noext;suf=Parser.h:GRAMMAR} ${noext;suf=Listener.h:$LISTENER} ${noext;suf=BaseListener.h:$LISTENER} ${noext;suf=Visitor.h:$VISITOR} ${noext;suf=BaseVisitor.h:$VISITOR} OUTPUT_INCLUDES ${ARCADIA_ROOT}/contrib/libs/antlr4_cpp_runtime/src/antlr4-runtime.h ${OUTPUT_INCLUDES})
  4266. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  4267. }
  4268. ### @usage: RUN_ANTLR4_GO(GRAMMAR, DEPS <extra_go_deps>, LISTENER, VISITOR, Args...)
  4269. ###
  4270. ### Macro to invoke ANTLR4 generator (Go)
  4271. macro RUN_ANTLR4_GO(GRAMMAR, DEPS[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  4272. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Go -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;tolower;suf=_lexer.go:GRAMMAR} ${noext;tolower;suf=_parser.go:GRAMMAR} ${noext;tolower;suf=_listener.go:$LISTENER} ${noext;tolower;suf=_base_listener.go:$LISTENER} ${noext;tolower;suf=_visitor.go:$VISITOR} ${noext;tolower;suf=_base_visitor.go:$VISITOR})
  4273. PEERDIR(${GOSTD}/fmt ${GOSTD}/reflect ${GOSTD}/strconv ${GOSTD}/sync ${GOSTD}/unicode vendor/github.com/antlr/antlr4/runtime/Go/antlr/v4 $DEPS)
  4274. }
  4275. ### @usage: RUN_ANTLR4_PYTHON(Grammar [LISTENER] [VISITOR] [SUBDIR] [EXTRA_OUTS Outs...] Args...)
  4276. ###
  4277. ### `LISTENER` - emit grammar listener
  4278. ### `VISITOR` - emit grammar visitor
  4279. ### `SUBDIR` - place generated files to specified subdirectory of BINDIR
  4280. ### `EXTRA_OUTS` - list extra outputs produced by Antlr (e.g. .interp and .token files) if they are needed. If `SUBDIR` is specied it will affect these as well. Use file names only.
  4281. ###
  4282. ### Macro to invoke ANTLR4 generator (Python). The Python3 will be used for PY3_LIBRARY/PY3_PROGRAM/PY3TEST, Python2 will be used in all other cases.
  4283. macro RUN_ANTLR4_PYTHON(GRAMMAR, LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", SUBDIR=".", EXTRA_OUTS[], _ANTLR4_EMPTY="", Args...) {
  4284. RUN_ANTLR4(${GRAMMAR} -Dlanguage=$ANTLR_PYTHON -o ${BINDIR}/${SUBDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT_NOAUTO ${nopath;noext;pre=${SUBDIR}/;suf=Lexer.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Parser.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Listener.py:$LISTENER} ${nopath;noext;pre=${SUBDIR}/;suf=Visitor.py:$VISITOR} ${pre=${SUBDIR}/:EXTRA_OUTS})
  4285. PEERDIR(contrib/python/antlr4)
  4286. }
  4287. # tag:cpp-specific
  4288. macro CPP_ADDINCL(Dirs...) {
  4289. ADDINCL($Dirs)
  4290. }
  4291. # tag:internal
  4292. _WHOLE_ARCHIVE_PEERS_VALUE=
  4293. ### @usage: WHOLE_ARCHIVE(dirnames...) # internal
  4294. macro WHOLE_ARCHIVE(PEERS...) {
  4295. SET_APPEND(_WHOLE_ARCHIVE_PEERS_VALUE ${PEERS})
  4296. REQUIRES(${PEERS})
  4297. }
  4298. ANDROID_SDK_ROOT=${ANDROID_SDK_RESOURCE_GLOBAL}/android_sdk
  4299. macro TASKLET() {
  4300. PEERDIR(tasklet/api)
  4301. # CPP
  4302. CPP_PROTO_PLUGIN(tasklet_cpp tasklet/v1/gen/cpp .tasklet.h)
  4303. # Python
  4304. PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/v1/gen/python DEPS tasklet/v1/domain/sandbox tasklet/v1/runtime sandbox/sdk2)
  4305. }
  4306. TASKLET_REG_INCLUDES= \
  4307. ${output_include;hide:"tasklet/v1/runtime/lib/cpp_wrapper.h"} \
  4308. ${output_include;hide:"tasklet/v1/runtime/lib/go_wrapper.h"} \
  4309. ${output_include;hide:"tasklet/v1/runtime/lib/py_wrapper.h"} \
  4310. ${output_include;hide:"tasklet/v1/runtime/lib/js_wrapper.h"} \
  4311. ${output_include;hide:"tasklet/v1/runtime/lib/registry.h"}
  4312. macro TASKLET_REG(Name, Lang, Impl, Includes...) {
  4313. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  4314. when($Lang == "js") {
  4315. # JS runtime links the Node.js from contrib as a library, which is a bit heavy,
  4316. # so we do it, only if any JS tasklets are linked into the target
  4317. PEERDIR+=tasklet/v1/runtime/js
  4318. }
  4319. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl ${output;noauto:Name.task.cpp} $Includes ${output_include;hide:Includes} $TASKLET_REG_INCLUDES ${kv;hide:"p TT"} ${kv;hide:"pc yellow"}
  4320. SRCS(GLOBAL $Name.task.cpp)
  4321. }
  4322. # TEMPORARY METHOD FOR EXTENDED REGISTRY SETUP
  4323. # NOT COMPLETE
  4324. macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) {
  4325. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  4326. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl -w $Wrapper ${output;noauto:Name.task.cpp} $Includes ${output_include;hide:Includes} $TASKLET_REG_INCLUDES ${kv;hide:"p TT"} ${kv;hide:"pc yellow"}
  4327. SRCS(GLOBAL $Name.task.cpp)
  4328. }
  4329. # tag:cpp-specific
  4330. _CPP_PROTO_MODULE_PREFIX=
  4331. _CPP_PROTO_MODULE_SUFFIX=
  4332. when ($MSVC == "yes" || $CYGWIN == "yes") {
  4333. _CPP_PROTO_MODULE_PREFIX=
  4334. _CPP_PROTO_MODULE_SUFFIX=.lib
  4335. }
  4336. otherwise {
  4337. _CPP_PROTO_MODULE_PREFIX=lib
  4338. _CPP_PROTO_MODULE_SUFFIX=.a
  4339. }
  4340. ### @usage: _EXPOSE(OutputsToExport...)
  4341. ###
  4342. ### Allows to mark outputs of macro command as unused in the current module but intended
  4343. ### to be used in modules consuming current via PEERDIR.
  4344. ###
  4345. ### TODO(DEVTOOLS-9000) proper implementation needed
  4346. macro _EXPOSE(Args...) {
  4347. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;suf=$_HASH_HELPER($Args).ya_exposed:"empty_"} ${input;hide:Args}
  4348. }
  4349. # tag:internal
  4350. ### @usage: _PROXY_LIBRARY() # internal
  4351. ###
  4352. ### The use of this module is strictly prohibited!!!
  4353. module _PROXY_LIBRARY: LIBRARY {
  4354. .EXTS=.a .lib
  4355. .PEERDIR_POLICY=as_build_from
  4356. .PROXY=yes
  4357. .FINAL_TARGET=yes
  4358. DISABLE(NEED_ADD_FAKE_SRC)
  4359. NO_UTIL()
  4360. NO_RUNTIME()
  4361. }
  4362. @import "${CONF_ROOT}/conf/project_specific/yql_udf.conf"
  4363. _PRIMARY_OUTPUT_VALUE=
  4364. # tag:internal
  4365. ### @usage: PRIMARY_OUTPUT_VALUE(Output) # internal
  4366. ###
  4367. ### The use of this module is strictly prohibited!!!
  4368. macro PRIMARY_OUTPUT(OUTPUT) {
  4369. SET(_PRIMARY_OUTPUT_VALUE $OUTPUT)
  4370. }
  4371. _DLL_PROXY_LIBRARY_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${input;hide:_PRIMARY_OUTPUT_VALUE} ${TARGET}
  4372. # tag:internal
  4373. ### @usage: DLL_PROXY_LIBRARY() # internal
  4374. ###
  4375. ### The use of this module is strictly prohibited!!!
  4376. module DLL_PROXY_LIBRARY: _PROXY_LIBRARY {
  4377. .ALLOWED=PRIMARY_OUTPUT
  4378. .CMD=_DLL_PROXY_LIBRARY_CMD
  4379. }
  4380. _PREBUILT_PROGRAM_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${TARGET} ${kv;hide:"p ld"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  4381. # tag:internal
  4382. ### @usage: PREBUILT_PROGRAM([programname]) # internal
  4383. ###
  4384. ### Program module which uses a prebuilt prgram as its output.
  4385. module PREBUILT_PROGRAM: _LINK_UNIT {
  4386. .CMD=_PREBUILT_PROGRAM_CMD
  4387. .SYMLINK_POLICY=EXE
  4388. .ALLOWED=INDUCED_DEPS PRIMARY_OUTPUT
  4389. .RESTRICTED=SRCS
  4390. _BARE_LINK_MODULE()
  4391. SET(MODULE_TYPE PROGRAM)
  4392. _DONT_REQUIRE_LICENSE()
  4393. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  4394. MODULE_SUFFIX=.exe
  4395. }
  4396. }
  4397. ### @usage COLLECT_JINJA_TEMPLATES(varname path)
  4398. ###
  4399. ### This macro collects all jinja and yaml files in the directory specified by second argument and
  4400. ### stores result in the variable with mane specified by first parameter.
  4401. macro COLLECT_JINJA_TEMPLATES(VAR, DIR) {
  4402. _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml)
  4403. }
  4404. @import "${CONF_ROOT}/conf/go.conf"
  4405. # Conflict between protobuf-java and protobuf-javalite ¯\_(ツ)_/¯
  4406. # both libraries are required by grpc
  4407. JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE=\
  4408. com.google.protobuf.AbstractMessageLite \
  4409. com.google.protobuf.AbstractMessageLite$Builder \
  4410. com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream \
  4411. com.google.protobuf.AbstractMessageLite$InternalOneOfEnum \
  4412. com.google.protobuf.AbstractParser \
  4413. com.google.protobuf.AbstractProtobufList \
  4414. com.google.protobuf.AllocatedBuffer \
  4415. com.google.protobuf.AllocatedBuffer$1 \
  4416. com.google.protobuf.AllocatedBuffer$2 \
  4417. com.google.protobuf.Android \
  4418. com.google.protobuf.Any \
  4419. com.google.protobuf.Any$1 \
  4420. com.google.protobuf.Any$Builder \
  4421. com.google.protobuf.AnyOrBuilder \
  4422. com.google.protobuf.AnyProto \
  4423. com.google.protobuf.Api \
  4424. com.google.protobuf.Api$1 \
  4425. com.google.protobuf.Api$Builder \
  4426. com.google.protobuf.ApiOrBuilder \
  4427. com.google.protobuf.ApiProto \
  4428. com.google.protobuf.ArrayDecoders \
  4429. com.google.protobuf.ArrayDecoders$1 \
  4430. com.google.protobuf.ArrayDecoders$Registers \
  4431. com.google.protobuf.BinaryReader \
  4432. com.google.protobuf.BinaryReader$1 \
  4433. com.google.protobuf.BinaryReader$SafeHeapReader \
  4434. com.google.protobuf.BinaryWriter \
  4435. com.google.protobuf.BinaryWriter$1 \
  4436. com.google.protobuf.BinaryWriter$SafeDirectWriter \
  4437. com.google.protobuf.BinaryWriter$SafeHeapWriter \
  4438. com.google.protobuf.BinaryWriter$UnsafeDirectWriter \
  4439. com.google.protobuf.BinaryWriter$UnsafeHeapWriter \
  4440. com.google.protobuf.BooleanArrayList \
  4441. com.google.protobuf.BoolValue \
  4442. com.google.protobuf.BoolValue$1 \
  4443. com.google.protobuf.BoolValue$Builder \
  4444. com.google.protobuf.BoolValueOrBuilder \
  4445. com.google.protobuf.BufferAllocator \
  4446. com.google.protobuf.BufferAllocator$1 \
  4447. com.google.protobuf.ByteBufferWriter \
  4448. com.google.protobuf.ByteOutput \
  4449. com.google.protobuf.ByteString \
  4450. com.google.protobuf.ByteString$1 \
  4451. com.google.protobuf.ByteString$2 \
  4452. com.google.protobuf.ByteString$AbstractByteIterator \
  4453. com.google.protobuf.ByteString$ArraysByteArrayCopier \
  4454. com.google.protobuf.ByteString$BoundedByteString \
  4455. com.google.protobuf.ByteString$ByteArrayCopier \
  4456. com.google.protobuf.ByteString$ByteIterator \
  4457. com.google.protobuf.ByteString$CodedBuilder \
  4458. com.google.protobuf.ByteString$LeafByteString \
  4459. com.google.protobuf.ByteString$LiteralByteString \
  4460. com.google.protobuf.ByteString$Output \
  4461. com.google.protobuf.ByteString$SystemByteArrayCopier \
  4462. com.google.protobuf.BytesValue \
  4463. com.google.protobuf.BytesValue$1 \
  4464. com.google.protobuf.BytesValue$Builder \
  4465. com.google.protobuf.BytesValueOrBuilder \
  4466. com.google.protobuf.CanIgnoreReturnValue \
  4467. com.google.protobuf.CheckReturnValue \
  4468. com.google.protobuf.CodedInputStream \
  4469. com.google.protobuf.CodedInputStream$1 \
  4470. com.google.protobuf.CodedInputStream$ArrayDecoder \
  4471. com.google.protobuf.CodedInputStream$IterableDirectByteBufferDecoder \
  4472. com.google.protobuf.CodedInputStream$StreamDecoder \
  4473. com.google.protobuf.CodedInputStream$StreamDecoder$RefillCallback \
  4474. com.google.protobuf.CodedInputStream$StreamDecoder$SkippedDataSink \
  4475. com.google.protobuf.CodedInputStream$UnsafeDirectNioDecoder \
  4476. com.google.protobuf.CodedInputStreamReader \
  4477. com.google.protobuf.CodedInputStreamReader$1 \
  4478. com.google.protobuf.CodedOutputStream \
  4479. com.google.protobuf.CodedOutputStream$1 \
  4480. com.google.protobuf.CodedOutputStream$AbstractBufferedEncoder \
  4481. com.google.protobuf.CodedOutputStream$ArrayEncoder \
  4482. com.google.protobuf.CodedOutputStream$ByteOutputEncoder \
  4483. com.google.protobuf.CodedOutputStream$HeapNioEncoder \
  4484. com.google.protobuf.CodedOutputStream$OutOfSpaceException \
  4485. com.google.protobuf.CodedOutputStream$OutputStreamEncoder \
  4486. com.google.protobuf.CodedOutputStream$SafeDirectNioEncoder \
  4487. com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder \
  4488. com.google.protobuf.CodedOutputStreamWriter \
  4489. com.google.protobuf.CodedOutputStreamWriter$1 \
  4490. com.google.protobuf.DoubleArrayList \
  4491. com.google.protobuf.DoubleValue \
  4492. com.google.protobuf.DoubleValue$1 \
  4493. com.google.protobuf.DoubleValue$Builder \
  4494. com.google.protobuf.DoubleValueOrBuilder \
  4495. com.google.protobuf.Duration \
  4496. com.google.protobuf.Duration$1 \
  4497. com.google.protobuf.Duration$Builder \
  4498. com.google.protobuf.DurationOrBuilder \
  4499. com.google.protobuf.DurationProto \
  4500. com.google.protobuf.Empty \
  4501. com.google.protobuf.Empty$1 \
  4502. com.google.protobuf.Empty$Builder \
  4503. com.google.protobuf.EmptyOrBuilder \
  4504. com.google.protobuf.EmptyProto \
  4505. com.google.protobuf.Enum \
  4506. com.google.protobuf.Enum$1 \
  4507. com.google.protobuf.Enum$Builder \
  4508. com.google.protobuf.EnumOrBuilder \
  4509. com.google.protobuf.EnumValue \
  4510. com.google.protobuf.EnumValue$1 \
  4511. com.google.protobuf.EnumValue$Builder \
  4512. com.google.protobuf.EnumValueOrBuilder \
  4513. com.google.protobuf.ExperimentalApi \
  4514. com.google.protobuf.ExtensionLite \
  4515. com.google.protobuf.ExtensionRegistryFactory \
  4516. com.google.protobuf.ExtensionRegistryLite \
  4517. com.google.protobuf.ExtensionRegistryLite$ExtensionClassHolder \
  4518. com.google.protobuf.ExtensionRegistryLite$ObjectIntPair \
  4519. com.google.protobuf.ExtensionSchema \
  4520. com.google.protobuf.ExtensionSchemaLite \
  4521. com.google.protobuf.ExtensionSchemaLite$1 \
  4522. com.google.protobuf.ExtensionSchemas \
  4523. com.google.protobuf.Field \
  4524. com.google.protobuf.Field$1 \
  4525. com.google.protobuf.Field$Builder \
  4526. com.google.protobuf.Field$Cardinality \
  4527. com.google.protobuf.Field$Cardinality$1 \
  4528. com.google.protobuf.Field$Kind \
  4529. com.google.protobuf.Field$Kind$1 \
  4530. com.google.protobuf.FieldInfo \
  4531. com.google.protobuf.FieldInfo$1 \
  4532. com.google.protobuf.FieldInfo$Builder \
  4533. com.google.protobuf.FieldMask \
  4534. com.google.protobuf.FieldMask$1 \
  4535. com.google.protobuf.FieldMask$Builder \
  4536. com.google.protobuf.FieldMaskOrBuilder \
  4537. com.google.protobuf.FieldMaskProto \
  4538. com.google.protobuf.FieldOrBuilder \
  4539. com.google.protobuf.FieldSet \
  4540. com.google.protobuf.FieldSet$1 \
  4541. com.google.protobuf.FieldSet$Builder \
  4542. com.google.protobuf.FieldSet$FieldDescriptorLite \
  4543. com.google.protobuf.FieldType \
  4544. com.google.protobuf.FieldType$1 \
  4545. com.google.protobuf.FieldType$Collection \
  4546. com.google.protobuf.FloatArrayList \
  4547. com.google.protobuf.FloatValue \
  4548. com.google.protobuf.FloatValue$1 \
  4549. com.google.protobuf.FloatValue$Builder \
  4550. com.google.protobuf.FloatValueOrBuilder \
  4551. com.google.protobuf.GeneratedMessageInfoFactory \
  4552. com.google.protobuf.GeneratedMessageLite \
  4553. com.google.protobuf.GeneratedMessageLite$1 \
  4554. com.google.protobuf.GeneratedMessageLite$Builder \
  4555. com.google.protobuf.GeneratedMessageLite$DefaultInstanceBasedParser \
  4556. com.google.protobuf.GeneratedMessageLite$ExtendableBuilder \
  4557. com.google.protobuf.GeneratedMessageLite$ExtendableMessage \
  4558. com.google.protobuf.GeneratedMessageLite$ExtendableMessage$ExtensionWriter \
  4559. com.google.protobuf.GeneratedMessageLite$ExtendableMessageOrBuilder \
  4560. com.google.protobuf.GeneratedMessageLite$ExtensionDescriptor \
  4561. com.google.protobuf.GeneratedMessageLite$GeneratedExtension \
  4562. com.google.protobuf.GeneratedMessageLite$MethodToInvoke \
  4563. com.google.protobuf.GeneratedMessageLite$SerializedForm \
  4564. com.google.protobuf.Int32Value \
  4565. com.google.protobuf.Int32Value$1 \
  4566. com.google.protobuf.Int32Value$Builder \
  4567. com.google.protobuf.Int32ValueOrBuilder \
  4568. com.google.protobuf.Int64Value \
  4569. com.google.protobuf.Int64Value$1 \
  4570. com.google.protobuf.Int64Value$Builder \
  4571. com.google.protobuf.Int64ValueOrBuilder \
  4572. com.google.protobuf.IntArrayList \
  4573. com.google.protobuf.Internal \
  4574. com.google.protobuf.Internal$BooleanList \
  4575. com.google.protobuf.Internal$DoubleList \
  4576. com.google.protobuf.Internal$EnumLite \
  4577. com.google.protobuf.Internal$EnumLiteMap \
  4578. com.google.protobuf.Internal$EnumVerifier \
  4579. com.google.protobuf.Internal$FloatList \
  4580. com.google.protobuf.Internal$IntList \
  4581. com.google.protobuf.Internal$ListAdapter \
  4582. com.google.protobuf.Internal$ListAdapter$Converter \
  4583. com.google.protobuf.Internal$LongList \
  4584. com.google.protobuf.Internal$MapAdapter \
  4585. com.google.protobuf.Internal$MapAdapter$1 \
  4586. com.google.protobuf.Internal$MapAdapter$Converter \
  4587. com.google.protobuf.Internal$MapAdapter$EntryAdapter \
  4588. com.google.protobuf.Internal$MapAdapter$IteratorAdapter \
  4589. com.google.protobuf.Internal$MapAdapter$SetAdapter \
  4590. com.google.protobuf.Internal$ProtobufList \
  4591. com.google.protobuf.InvalidProtocolBufferException \
  4592. com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException \
  4593. com.google.protobuf.IterableByteBufferInputStream \
  4594. com.google.protobuf.JavaType \
  4595. com.google.protobuf.LazyField \
  4596. com.google.protobuf.LazyField$1 \
  4597. com.google.protobuf.LazyField$LazyEntry \
  4598. com.google.protobuf.LazyField$LazyIterator \
  4599. com.google.protobuf.LazyFieldLite \
  4600. com.google.protobuf.LazyStringArrayList \
  4601. com.google.protobuf.LazyStringArrayList$ByteArrayListView \
  4602. com.google.protobuf.LazyStringArrayList$ByteStringListView \
  4603. com.google.protobuf.LazyStringList \
  4604. com.google.protobuf.ListFieldSchema \
  4605. com.google.protobuf.ListFieldSchema$1 \
  4606. com.google.protobuf.ListFieldSchema$ListFieldSchemaFull \
  4607. com.google.protobuf.ListFieldSchema$ListFieldSchemaLite \
  4608. com.google.protobuf.ListValue \
  4609. com.google.protobuf.ListValue$1 \
  4610. com.google.protobuf.ListValue$Builder \
  4611. com.google.protobuf.ListValueOrBuilder \
  4612. com.google.protobuf.LongArrayList \
  4613. com.google.protobuf.ManifestSchemaFactory \
  4614. com.google.protobuf.ManifestSchemaFactory$1 \
  4615. com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory \
  4616. com.google.protobuf.MapEntryLite \
  4617. com.google.protobuf.MapEntryLite$1 \
  4618. com.google.protobuf.MapEntryLite$Metadata \
  4619. com.google.protobuf.MapFieldLite \
  4620. com.google.protobuf.MapFieldSchema \
  4621. com.google.protobuf.MapFieldSchemaLite \
  4622. com.google.protobuf.MapFieldSchemas \
  4623. com.google.protobuf.MessageInfo \
  4624. com.google.protobuf.MessageInfoFactory \
  4625. com.google.protobuf.MessageLite \
  4626. com.google.protobuf.MessageLite$Builder \
  4627. com.google.protobuf.MessageLiteOrBuilder \
  4628. com.google.protobuf.MessageLiteToString \
  4629. com.google.protobuf.MessageSchema \
  4630. com.google.protobuf.MessageSchema$1 \
  4631. com.google.protobuf.MessageSetSchema \
  4632. com.google.protobuf.Method \
  4633. com.google.protobuf.Method$1 \
  4634. com.google.protobuf.Method$Builder \
  4635. com.google.protobuf.MethodOrBuilder \
  4636. com.google.protobuf.Mixin \
  4637. com.google.protobuf.Mixin$1 \
  4638. com.google.protobuf.Mixin$Builder \
  4639. com.google.protobuf.MixinOrBuilder \
  4640. com.google.protobuf.MutabilityOracle \
  4641. com.google.protobuf.MutabilityOracle$1 \
  4642. com.google.protobuf.NewInstanceSchema \
  4643. com.google.protobuf.NewInstanceSchemaLite \
  4644. com.google.protobuf.NewInstanceSchemas \
  4645. com.google.protobuf.NioByteString \
  4646. com.google.protobuf.NioByteString$1 \
  4647. com.google.protobuf.NullValue \
  4648. com.google.protobuf.NullValue$1 \
  4649. com.google.protobuf.OneofInfo \
  4650. com.google.protobuf.Option \
  4651. com.google.protobuf.Option$1 \
  4652. com.google.protobuf.Option$Builder \
  4653. com.google.protobuf.OptionOrBuilder \
  4654. com.google.protobuf.Parser \
  4655. com.google.protobuf.PrimitiveNonBoxingCollection \
  4656. com.google.protobuf.Protobuf \
  4657. com.google.protobuf.ProtobufArrayList \
  4658. com.google.protobuf.ProtobufLists \
  4659. com.google.protobuf.ProtocolStringList \
  4660. com.google.protobuf.ProtoSyntax \
  4661. com.google.protobuf.RawMessageInfo \
  4662. com.google.protobuf.Reader \
  4663. com.google.protobuf.RopeByteString \
  4664. com.google.protobuf.RopeByteString$1 \
  4665. com.google.protobuf.RopeByteString$Balancer \
  4666. com.google.protobuf.RopeByteString$PieceIterator \
  4667. com.google.protobuf.RopeByteString$RopeInputStream \
  4668. com.google.protobuf.Schema \
  4669. com.google.protobuf.SchemaFactory \
  4670. com.google.protobuf.SchemaUtil \
  4671. com.google.protobuf.SmallSortedMap \
  4672. com.google.protobuf.SmallSortedMap$1 \
  4673. com.google.protobuf.SmallSortedMap$DescendingEntryIterator \
  4674. com.google.protobuf.SmallSortedMap$DescendingEntrySet \
  4675. com.google.protobuf.SmallSortedMap$EmptySet \
  4676. com.google.protobuf.SmallSortedMap$EmptySet$1 \
  4677. com.google.protobuf.SmallSortedMap$EmptySet$2 \
  4678. com.google.protobuf.SmallSortedMap$Entry \
  4679. com.google.protobuf.SmallSortedMap$EntryIterator \
  4680. com.google.protobuf.SmallSortedMap$EntrySet \
  4681. com.google.protobuf.SourceContext \
  4682. com.google.protobuf.SourceContext$1 \
  4683. com.google.protobuf.SourceContext$Builder \
  4684. com.google.protobuf.SourceContextOrBuilder \
  4685. com.google.protobuf.SourceContextProto \
  4686. com.google.protobuf.StringValue \
  4687. com.google.protobuf.StringValue$1 \
  4688. com.google.protobuf.StringValue$Builder \
  4689. com.google.protobuf.StringValueOrBuilder \
  4690. com.google.protobuf.Struct \
  4691. com.google.protobuf.Struct$1 \
  4692. com.google.protobuf.Struct$Builder \
  4693. com.google.protobuf.Struct$FieldsDefaultEntryHolder \
  4694. com.google.protobuf.StructOrBuilder \
  4695. com.google.protobuf.StructProto \
  4696. com.google.protobuf.StructuralMessageInfo \
  4697. com.google.protobuf.StructuralMessageInfo$Builder \
  4698. com.google.protobuf.Syntax \
  4699. com.google.protobuf.Syntax$1 \
  4700. com.google.protobuf.TextFormatEscaper \
  4701. com.google.protobuf.TextFormatEscaper$1 \
  4702. com.google.protobuf.TextFormatEscaper$2 \
  4703. com.google.protobuf.TextFormatEscaper$ByteSequence \
  4704. com.google.protobuf.Timestamp \
  4705. com.google.protobuf.Timestamp$1 \
  4706. com.google.protobuf.Timestamp$Builder \
  4707. com.google.protobuf.TimestampOrBuilder \
  4708. com.google.protobuf.TimestampProto \
  4709. com.google.protobuf.Type \
  4710. com.google.protobuf.Type$1 \
  4711. com.google.protobuf.Type$Builder \
  4712. com.google.protobuf.TypeOrBuilder \
  4713. com.google.protobuf.TypeProto \
  4714. com.google.protobuf.UInt32Value \
  4715. com.google.protobuf.UInt32Value$1 \
  4716. com.google.protobuf.UInt32Value$Builder \
  4717. com.google.protobuf.UInt32ValueOrBuilder \
  4718. com.google.protobuf.UInt64Value \
  4719. com.google.protobuf.UInt64Value$1 \
  4720. com.google.protobuf.UInt64Value$Builder \
  4721. com.google.protobuf.UInt64ValueOrBuilder \
  4722. com.google.protobuf.UninitializedMessageException \
  4723. com.google.protobuf.UnknownFieldSchema \
  4724. com.google.protobuf.UnknownFieldSetLite \
  4725. com.google.protobuf.UnknownFieldSetLiteSchema \
  4726. com.google.protobuf.UnmodifiableLazyStringList \
  4727. com.google.protobuf.UnmodifiableLazyStringList$1 \
  4728. com.google.protobuf.UnmodifiableLazyStringList$2 \
  4729. com.google.protobuf.UnsafeByteOperations \
  4730. com.google.protobuf.UnsafeUtil \
  4731. com.google.protobuf.UnsafeUtil$1 \
  4732. com.google.protobuf.UnsafeUtil$Android32MemoryAccessor \
  4733. com.google.protobuf.UnsafeUtil$Android64MemoryAccessor \
  4734. com.google.protobuf.UnsafeUtil$JvmMemoryAccessor \
  4735. com.google.protobuf.UnsafeUtil$MemoryAccessor \
  4736. com.google.protobuf.Utf8 \
  4737. com.google.protobuf.Utf8$DecodeUtil \
  4738. com.google.protobuf.Utf8$Processor \
  4739. com.google.protobuf.Utf8$SafeProcessor \
  4740. com.google.protobuf.Utf8$UnpairedSurrogateException \
  4741. com.google.protobuf.Utf8$UnsafeProcessor \
  4742. com.google.protobuf.Value \
  4743. com.google.protobuf.Value$1 \
  4744. com.google.protobuf.Value$Builder \
  4745. com.google.protobuf.Value$KindCase \
  4746. com.google.protobuf.ValueOrBuilder \
  4747. com.google.protobuf.WireFormat \
  4748. com.google.protobuf.WireFormat$1 \
  4749. com.google.protobuf.WireFormat$FieldType \
  4750. com.google.protobuf.WireFormat$FieldType$1 \
  4751. com.google.protobuf.WireFormat$FieldType$2 \
  4752. com.google.protobuf.WireFormat$FieldType$3 \
  4753. com.google.protobuf.WireFormat$FieldType$4 \
  4754. com.google.protobuf.WireFormat$JavaType \
  4755. com.google.protobuf.WireFormat$Utf8Validation \
  4756. com.google.protobuf.WireFormat$Utf8Validation$1 \
  4757. com.google.protobuf.WireFormat$Utf8Validation$2 \
  4758. com.google.protobuf.WireFormat$Utf8Validation$3 \
  4759. com.google.protobuf.WrappersProto \
  4760. com.google.protobuf.Writer \
  4761. com.google.protobuf.Writer$FieldOrder
  4762. # tag:java-specific
  4763. JAVA_IGNORE_CLASSPATH_CLASH_VALUE=$JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE
  4764. ### @usage: JAVA_IGNORE_CLASSPATH_CLASH_FOR([classes])
  4765. ### Ignore classpath clash test fails for classes
  4766. macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) {
  4767. SET_APPEND(JAVA_IGNORE_CLASSPATH_CLASH_VALUE $Args $JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE)
  4768. }
  4769. IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  4770. # tag:src-processing
  4771. STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text
  4772. macro _SRC("storyboard", SRC, SRCFLAGS...) {
  4773. .CMD=$IBTOOL_PATH $STORYBOARD_FLAGS --module $REALPRJNAME --output-partial-info-plist ${output;suf=.partial_plist:SRC} --compilation-directory $BINDIR ${input:SRC} && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.compiled_storyboard_tar:SRC} $BINDIR/${nopath;suf=c:SRC} $BINDIR/${nopath;suf=c:SRC}
  4774. }
  4775. # tag:src-processing
  4776. macro _SRC("xib", SRC, SRCFLAGS...) {
  4777. .CMD=$IBTOOL_PATH $STORYBOARD_FLAGS --module $REALPRJNAME --output-partial-info-plist ${output;suf=.partial_plist:SRC} --compile ${output;tobindir;nopath;noext;suf=.nib:SRC} ${input:SRC}
  4778. }
  4779. ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  4780. # tag:ios-specific
  4781. ASSETS_FLAGS=--output-format human-readable-text --notices --warnings
  4782. macro _IOS_ASSETS(AssetsDir, Content...) {
  4783. .CMD=$FS_TOOLS md $BINDIR/$REALPRJNAME && $ACTOOL_PATH $ASSETS_FLAGS --export-dependency-info $BINDIR/assetcatalog_dependencies --output-partial-info-plist ${output:"assetcatalog_generated_info.partial_plist"} --product-type com.apple.product-type.application --compile $BINDIR/$REALPRJNAME $AssetsDir ${input;hide:Content} && ${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;suf=_assetes.resource_tar:REALPRJNAME} $REALPRJNAME $REALPRJNAME
  4784. }
  4785. # tag:ios-specific
  4786. macro IOS_APP_COMMON_FLAGS(Flags...) {
  4787. SET_APPEND(STORYBOARD_FLAGS $Flags)
  4788. SET_APPEND(ASSETS_FLAGS $Flags)
  4789. }
  4790. # tag:ios-specific
  4791. macro IOS_APP_ASSETS_FLAGS(Flags...) {
  4792. SET_APPEND(ASSETS_FLAGS $Flags)
  4793. }
  4794. macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) {
  4795. .CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR
  4796. }
  4797. macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) {
  4798. .CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR
  4799. }
  4800. # tag:ios-specific
  4801. DELIM=__DELIM__
  4802. PACK_IOS_ARCHIVE=$GENERATE_MF && $YMAKE_PYTHON ${input:"build/scripts/ios_wrapper.py"} bin $IBTOOL_PATH $TARGET $REALPRJNAME $BINDIR $DELIM $AUTO_INPUT $DELIM $STORYBOARD_FLAGS
  4803. ### @usage: IOS_INTERFACE()
  4804. ### iOS GUI module definition
  4805. module IOS_INTERFACE: _BARE_UNIT {
  4806. .CMD=PACK_IOS_ARCHIVE
  4807. .EXTS=.compiled_storyboard_tar .partial_plist .plist .xcent .nib .resource_tar .signed_resource_tar .strings_tar .plist_json
  4808. .NODE_TYPE=Library
  4809. .FINAL_TARGET=no
  4810. SET(MODULE_SUFFIX .ios.interface)
  4811. PEERDIR+=build/platform/xcode/tools
  4812. }
  4813. # tag:ios-specific
  4814. module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
  4815. SET(MODULE_SUFFIX .default.ios.interface)
  4816. }
  4817. DEFAULT_IOS_TYPE=
  4818. IOS_TYPE=
  4819. when(!$IOS_TYPE) {
  4820. when($DEFAULT_IOS_TYPE) {
  4821. IOS_TYPE=$DEFAULT_IOS_TYPE
  4822. }
  4823. otherwise {
  4824. IOS_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-X
  4825. }
  4826. }
  4827. DEFAULT_IOS_RUNTIME=
  4828. IOS_RUNTIME=
  4829. when(!$IOS_RUNTIME) {
  4830. when($DEFAULT_IOS_RUNTIME) {
  4831. IOS_RUNTIME=$DEFAULT_IOS_RUNTIME
  4832. }
  4833. otherwise {
  4834. IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-1
  4835. }
  4836. }
  4837. when ($ARCH_I386) {
  4838. TEST_IOS_DEVICE_TYPE_VALUE=com.apple.CoreSimulator.SimDeviceType.iPhone-5
  4839. TEST_IOS_RUNTIME_TYPE_VALUE=com.apple.CoreSimulator.SimRuntime.iOS-10-3
  4840. }
  4841. otherwise {
  4842. TEST_IOS_DEVICE_TYPE_VALUE=$IOS_TYPE
  4843. TEST_IOS_RUNTIME_TYPE_VALUE=$IOS_RUNTIME
  4844. }
  4845. # tag:frontend-specific
  4846. ### @usage: COLLECT_FRONTEND_FILES(Varname, Dir)
  4847. ###
  4848. ### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname
  4849. macro COLLECT_FRONTEND_FILES(Varname, Dir) {
  4850. _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html))
  4851. }
  4852. # tag:swift-specific
  4853. CPP_XCODE_TOOLCHAIN_VERSION=9.2
  4854. SWIFT_XCODE_TOOLCHAIN_VERSION=9.2
  4855. XCODE_TOOLS_VERSION=10.1
  4856. macro COMPILE_SWIFT_MODULE(SRCS{input}[], BRIDGE_HEADER{input}="", Flags...) {
  4857. when ($BRIDGE_HEADER != "") {
  4858. SWIFT_BRIDGE_HEADER=-import-objc-header ${input:BRIDGE_HEADER}
  4859. }
  4860. otherwise {
  4861. SWIFT_BRIDGE_HEADER=
  4862. }
  4863. .PEERDIR+=build/platform/xcode/swift
  4864. # swift core libraries
  4865. LDFLAGS($SWIFT_LD_FLAGS)
  4866. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_swiftc_output_map.py"} $(SOURCE_ROOT) $(BUILD_ROOT) $BINDIR/swift_output_map.json ${input:SRCS} && $SWIFT_COMPILER -c $SWIFT_FLAGS_PLATFORM $Flags $SWIFT_BRIDGE_HEADER ${pre=-Xcc -I:_C__INCLUDE} ${input:SRCS} -emit-objc-header -emit-objc-header-path ${output;suf=-Swift.h:REALPRJNAME} -emit-module -module-name $REALPRJNAME -output-file-map $BINDIR/swift_output_map.json ${output;hide;suf=.o:SRCS}
  4867. }
  4868. TEST_TOOL_HOST_LOCAL=
  4869. TEST_TOOL_TARGET_LOCAL=
  4870. when ($MOST_USED_CUDA) {
  4871. CUDA_VERSION=11.4
  4872. CUDNN_VERSION=8.0.5
  4873. TENSORRT_VERSION=7
  4874. }
  4875. when ($TENSORFLOW_WITH_CUDA) {
  4876. CUDA_REQUIRED=yes
  4877. }
  4878. when (!$TENSORRT_VERSION) {
  4879. TENSORRT_VERSION=5
  4880. }
  4881. ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
  4882. # tag:windows-specific
  4883. WINDOWS_MANIFEST=
  4884. macro WINDOWS_MANIFEST(Manifest) {
  4885. SET(WINDOWS_MANIFEST $Manifest)
  4886. }
  4887. # https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation#enable-long-paths-in-windows-10-version-1607-and-later
  4888. macro WINDOWS_LONG_PATH_MANIFEST() {
  4889. SET(WINDOWS_MANIFEST build/long-path.manifest)
  4890. }
  4891. # tag:windows-specific
  4892. when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
  4893. LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
  4894. }
  4895. # tag:cpp-specific
  4896. _VISIBILITY_LEVEL=
  4897. ### @usage: VISIBILITY(level)
  4898. ###
  4899. ### This macro sets visibility level for symbols compiled for the current module. 'level'
  4900. ### may take only one of the following values: DEFAULT, HIDDEN.
  4901. macro VISIBILITY(LEVEL) {
  4902. SET(_VISIBILITY_LEVEL ${LEVEL})
  4903. select ($LEVEL) {
  4904. "DEFAULT" | "HIDDEN" ? {
  4905. }
  4906. default ? {
  4907. _OK = no
  4908. }
  4909. }
  4910. ASSERT(_OK Unsupported value [$LEVEL] passed to VISIBILITY macro, expected values are DEFAULT, HIDDEN.)
  4911. }
  4912. # tag:cpp-specific
  4913. _CFLAGS_VISIBILITY=
  4914. when ($_VISIBILITY_LEVEL != "" && $IGNORE_VISIBILITY != "yes") {
  4915. when ($CLANG == "yes" || $GCC == "yes") {
  4916. _CFLAGS_VISIBILITY=-fvisibility=${tolower:_VISIBILITY_LEVEL}
  4917. }
  4918. }
  4919. CFLAGS+=$_CFLAGS_VISIBILITY
  4920. # tag:cpp-specific
  4921. macro SDBUS_CPP_ADAPTOR(File) {
  4922. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --adaptor=${output;nopath;noext:File.adaptor.h} ${input:File}
  4923. .PEERDIR=contrib/libs/sdbus-cpp
  4924. }
  4925. # tag:cpp-specific
  4926. macro SDBUS_CPP_PROXY(File) {
  4927. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --proxy=${output;nopath;noext:File.proxy.h} ${input:File}
  4928. .PEERDIR=contrib/libs/sdbus-cpp
  4929. }
  4930. # tag:python-specific
  4931. macro _PY_ENUM_SERIALIZATION_TO_JSON(File) {
  4932. .CMD=$ENUM_PARSER_TOOL ${input:File} --output ${output;noext;suf=.generated.h:File} --json-output ${output;noext:File.json} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  4933. }
  4934. # tag:python-specific
  4935. macro _PY_ENUM_SERIALIZATION_TO_PY(File) {
  4936. .CMD=${tool:"metrika/core/tools/python_enum_generator"} ${input;noext:File.json} -D ${MODDIR} --output ${output;noext:File.py} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  4937. }
  4938. macro NGINX_MODULES(Modules...) {
  4939. PEERDIR(${Modules})
  4940. RUN_PROGRAM(nginx/module_gen ${Modules} CWD ${ARCADIA_ROOT} IN ${suf=/modules.json:Modules} OUTPUT_INCLUDES contrib/nginx/core/src/core/ngx_config.h contrib/nginx/core/src/core/ngx_core.h STDOUT ngx_modules.c)
  4941. }
  4942. ### @usage: ORIGINAL_SOURCE(Source)
  4943. ###
  4944. ### This macro specifies the source repository for contrib
  4945. ### Does nothing now (just a placeholder for future functionality)
  4946. ### See https://st.yandex-team.ru/DTCC-316
  4947. macro ORIGINAL_SOURCE(Source) {
  4948. ENABLE(UNUSED_MACRO)
  4949. }
  4950. # tag:licence
  4951. CREDITS_FILE_EXTRA_EXT=
  4952. CREDITS_FLAGS=
  4953. CREDITS_TEXTS_FILE=
  4954. NO_CREDITS_TEXTS_FILE=
  4955. WITH_CREDITS=
  4956. ### @usage: LICENSE_TEXTS(File)
  4957. ###
  4958. ### This macro specifies the filename with all library licenses texts
  4959. macro LICENSE_TEXTS(Source) {
  4960. SET(CREDITS_TEXTS_FILE $Source)
  4961. }
  4962. # tag:licence
  4963. ### @usage: WITHOUT_LICENSE_TEXTS()
  4964. ###
  4965. ### This macro indicates that the module has no license text
  4966. macro WITHOUT_LICENSE_TEXTS() {
  4967. ENABLE(NO_CREDITS_TEXTS_FILE)
  4968. }
  4969. # tag:licence
  4970. when ($WITH_CREDITS) {
  4971. CREDITS_FLAGS+=--credits-output ${output;suf=${CREDITS_FILE_EXTRA_EXT}".CREDITS.txt":REALPRJNAME}
  4972. }
  4973. GENERATE_MF=
  4974. when ($WITH_CREDITS) {
  4975. GENERATE_MF=$GENERATE_MF_CMD
  4976. }
  4977. macro _MCU_CONVERT(Bin) {
  4978. .CMD=${cwd:BINDIR} $OBJCOPY_TOOL -O ihex $Bin ${output;noext:Bin.hex} && ${cwd:BINDIR} $OBJCOPY_TOOL -O srec $Bin ${output;noext:Bin.s37} && ${cwd:BINDIR} $OBJCOPY_TOOL -O binary $Bin ${output;noext:Bin.bin}
  4979. }
  4980. MCU_LINK_EXE=$LINK_EXE && $_MCU_CONVERT($MODULE_PREFIX$REALPRJNAME)
  4981. ### @usage: MCU_PROGRAM([progname])
  4982. ###
  4983. ### Program module for microcontrollers. Converts ELF to Intel HEX, Motorola S-record and raw binary file formats.
  4984. ### If name is not specified it will be generated from the name of the containing project directory.
  4985. module MCU_PROGRAM: PROGRAM {
  4986. .CMD=MCU_LINK_EXE
  4987. }
  4988. # tag:flags tag:internal tag:windows-specific
  4989. ### @usage: _MSVC_FLAGS_WINDOWS_IMPL(target_platform compiler_flags) # internal
  4990. ###
  4991. ### Add CFLAGS when the firts argument is WINDOWS
  4992. macro _MSVC_FLAGS_WINDOWS_IMPL(WINDOWS[], FLAGS...) {
  4993. CFLAGS($WINDOWS)
  4994. }
  4995. # tag:flags tag:windows-specific tag:cpp-specific
  4996. ### @usage: MSVC_FLAGS([GLOBAL compiler_flag]* compiler_flags)
  4997. ###
  4998. ### Add the specified flags to the compilation line of C/C++files.
  4999. ### Flags apply only if the compiler used is MSVC (cl.exe)
  5000. macro MSVC_FLAGS(FLAGS...) {
  5001. _MSVC_FLAGS_WINDOWS_IMPL($TARGET_PLATFORM $FLAGS)
  5002. }
  5003. ### @usage: COLLECT_YDB_API_SPECS_LEGACY(VarName Paths...) #deprecated
  5004. ###
  5005. ### This macro is ugly hack for legacy YDB go API codegen, any other uses are prohibited
  5006. macro COLLECT_YDB_API_SPECS_LEGACY(FILES_VAR, PATHS...) {
  5007. _GLOB($FILES_VAR ${suf=/*.proto:PATHS})
  5008. RESTRICT_PATH(kikimr/public/sdk/go/ydb/api MSG This is ugly hack for legacy YDB go API codegen, any other uses are probibited)
  5009. }
  5010. # tag:proto tag:apphost
  5011. ### @usage: APPHOST()
  5012. ###
  5013. ### Emit APPHOST service code for all .proto files in a PROTO_LIBRARY.
  5014. ### This works only for C++ and Java at the moment.
  5015. macro APPHOST() {
  5016. # C++
  5017. CPP_PROTO_PLUGIN(cpp_plugin apphost/tools/stub_generator/cpp_plugin .apphost.h DEPS apphost/tools/stub_generator/cpp_includes)
  5018. # Java
  5019. JAVA_PROTO_PLUGIN(java_plugin apphost/tools/stub_generator/java_plugin DEPS apphost/api/service/java/apphost)
  5020. }
  5021. # tag:internal
  5022. ### Add passed ya.conf.json and all bottle's formula external files to resources
  5023. ### File MUST be arcadia root relative path (without "${ARCADIA_ROOT}/" prefix).
  5024. ### NOTE:
  5025. ### An external formula file referenced from ya.conf.json must be passed as an arcadia root relative path and
  5026. ### should be located in any subdirectory of the ya.conf.json location ("build/" if we consider a production).
  5027. ### The later restriction prevents problems in selectively checkouted arcadia.
  5028. macro YA_CONF_JSON(File) {
  5029. _YA_CONF_JSON($File)
  5030. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/$File)
  5031. }
  5032. # tag:internal
  5033. # Don't use directly - wrap with custom macros
  5034. macro ADD_LINTER_CHECK(CheckName, Linter, DEPENDS[], EXCLUDE[], FILES[], CONFIGS[]) {
  5035. SET(_FILES_VAR uniq_${hash:VAR_SALT})
  5036. _GLOB($_FILES_VAR $FILES EXCLUDE $EXCLUDE)
  5037. _ADD_LINTER_CHECK($CheckName $Linter ${pre=DEPENDS :DEPENDS} FILES $$_FILES_VAR CONFIGS $CONFIGS)
  5038. }
  5039. # tag:internal
  5040. # Draft. Don't use.
  5041. macro _CPP_STYLE(EXCLUDE[], Files...) {
  5042. ADD_LINTER_CHECK(cpp_style tools/cpp_style_checker/cpp_style_checker DEPENDS contrib/libs/clang12/tools/clang-format EXCLUDE $EXCLUDE FILES $Files CONFIGS devtools/ya/handlers/style/style_config)
  5043. }
  5044. # tag:proto
  5045. macro ALICE_CAPABILITY() {
  5046. CPP_PROTO_PLUGIN(alice_capability_cpp yandex_io/tools/capability_gen .cap.h DEPS yandex_io/libs/protobuf_utils)
  5047. JAVA_PROTO_PLUGIN(alice_capability_java alice/library/go/java_marker_interface_protoc_plugin DEPS alice/protos/endpoint/java_interface alice/megamind/protos/scenarios/java_interface)
  5048. }
  5049. ### @usage: CLANG_EMIT_AST_CXX_RUN_TOOL(Tool Args... [SOURCES ...] [OPTS ...] [IN ...] [IN_NOPARSE ...] [TOOL ...] [OUTPUT_INCLUDES ...] [INDUCED_DEPS ...] [IN_DEPS ...] [STDOUT out-file-name] [STDOUT_NOAUTO out-file-name] [CWD cwd])
  5050. ###
  5051. ### Emit Clang ASTs from .cpp files listed in SOURCES parameter (CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not) and run tool Tool with Args... .
  5052. ### OPTS[] parameter is used to pass additional flags to clang. Parameters other than OPTS[] and SOURCES[] are used for runnig a generator (Tool):
  5053. ### - Tool - path to the directory of the tool
  5054. ### - Args... - Tool's arguments
  5055. ### - IN[] - input files required for running the Tool
  5056. ### - IN_NOPARSE[] - input files required for running the Tool, but these files are not parsed for dependencies
  5057. ### - TOOL[] - list of directories of axiliary tools used by Tool
  5058. ### - OUTPUT_INCLUDES[] - includes of the output files which are needed to "build" them
  5059. ### - STDOUT - redirect stdout of the Tool to the output file
  5060. ### - STDOUT_NOAUTO - redirect stdout of the Tool to the output file, but do not chain this file automatically to the processing queue
  5061. ### - CWD - path to the working directory of the Tool
  5062. ### Note: Generated AST files generated into BINDIR according to corresponding .cpp file names listed in SOURCES parameter.
  5063. macro CLANG_EMIT_AST_CXX_RUN_TOOL(SOURCES[], OPTS[], Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  5064. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_CPP_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS -emit-ast -c ${input:SOURCES} ${hide;tmp;noext;nopath:SOURCES.ast} $OPTS ${kv;hide:"p ST"} ${kv;hide:"pc light-green"} && ${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  5065. PEERDIR(build/platform/clang)
  5066. }
  5067. @import "${CONF_ROOT}/conf/misc.conf"