ymake.core.conf 241 KB

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