ymake.core.conf 231 KB

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