ymake.core.conf 335 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623
  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. FORCE_COVERAGE_ENABLED=
  33. FORCE_COVERAGE_DISABLED=
  34. AUTOCHECK_BALANCING_OPTIONS=
  35. SO_OUTPUTS=no
  36. @import "${CONF_ROOT}/conf/settings.conf"
  37. @import "${CONF_ROOT}/conf/opensource.conf"
  38. @import "${CONF_ROOT}/conf/rules.conf"
  39. @import "${CONF_ROOT}/conf/sysincl.conf"
  40. @import "${CONF_ROOT}/conf/license.conf"
  41. @import "${CONF_ROOT}/conf/ts/ts.conf"
  42. @import "${CONF_ROOT}/conf/docs.conf"
  43. @import "${CONF_ROOT}/conf/swig.conf"
  44. @import "${CONF_ROOT}/conf/perl.conf"
  45. @import "${CONF_ROOT}/conf/project_specific/other.conf"
  46. @import "${CONF_ROOT}/conf/project_specific/uservices.conf"
  47. @import "${CONF_ROOT}/conf/project_specific/yt.conf"
  48. USE_GLOBAL_CMD=no
  49. when ($OS_WINDOWS != "yes") {
  50. USE_GLOBAL_CMD=yes
  51. }
  52. when ($USE_PYTHON) {
  53. C_DEFINES+= -DUSE_PYTHON
  54. }
  55. __COMMA__=${comma:""}
  56. ARCADIA_TEST_ROOT=../arcadia_tests_data/
  57. DEFAULT_REQUIREMENTS=network:restricted cpu:1 ram:32
  58. FAIL_PY2=no
  59. _PREBUILT_TOOLS_ROOT=build/prebuilt
  60. _TOOL_PROTOC_GEN_GO=vendor/github.com/golang/protobuf/protoc-gen-go
  61. _TOOL_PROTOC_GEN_GO_V2=vendor/google.golang.org/protobuf/cmd/protoc-gen-go
  62. _TOOL_PROTOC_GEN_GO_GRPC_V2=vendor/google.golang.org/grpc/cmd/protoc-gen-go-grpc
  63. _TOOL_RESCOMPILER=tools/rescompiler
  64. _TOOL_RESCOMPRESSOR=tools/rescompressor
  65. _TOOL_RORESCOMPILER=tools/rorescompiler
  66. when ($DISABLE_SEPARATE_AUX_CPP != "yes") {
  67. SEPARATE_AUX_CPP=yes
  68. }
  69. when ($HOST_ARCH_X86_64 == "yes") {
  70. when ($HOST_OS_DARWIN == "yes" || $HOST_OS_LINUX == "yes" || $HOST_OS_WINDOWS == "yes") {
  71. VALID_HOST_PLATFORM_FOR_COMMON_PREBUILT_TOOLS=yes
  72. when ($USE_PREBUILT_TOOLS == "yes" && $ARCH_X86_64 == "yes") {
  73. _TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
  74. }
  75. }
  76. }
  77. FAIL_MODULE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${kv;hide:"p ER"} ${kv;hide:"pc red"}
  78. DEFAULT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  79. PROJECT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  80. TIDY=
  81. TIDY_ENABLED=
  82. when($TIDY == "yes") {
  83. TIDY_ENABLED=yes
  84. }
  85. when ($TIDY_ENABLED == "yes") {
  86. when ($TIDY_EXPORT_FIXES=="") {
  87. TIDY_EXPORT_FIXES="no"
  88. }
  89. 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
  90. CLANG_TIDY_ARGS+="--default-config-file" ${input:DEFAULT_TIDY_CONFIG}
  91. CLANG_TIDY_ARGS+="--project-config-file" ${input:PROJECT_TIDY_CONFIG}
  92. when ($TIDY_CHECKS) {
  93. CLANG_TIDY_ARGS+="--checks=$TIDY_CHECKS"
  94. }
  95. when ($TIDY_HEADER_FILTER) {
  96. CLANG_TIDY_ARGS+="--header-filter=$TIDY_HEADER_FILTER"
  97. }
  98. TIDY_VALUE=USE_CONDITIONAL_SRCS
  99. }
  100. otherwise {
  101. CLANG_TIDY_ARGS=
  102. TIDY_VALUE=
  103. }
  104. # tag:codenav
  105. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  106. PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
  107. YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $CPPYNDEXER_RESOURCE_GLOBAL/yndexer 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
  108. YNDEXER_OUTPUT=${output;noauto;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.ydx.pb2:SRC}
  109. }
  110. otherwise {
  111. PY_PROGRAM_LINK_EXE=$LINK_EXE
  112. YNDEXER_ARGS=
  113. YNDEXER_OUTPUT=
  114. }
  115. when ($RETRY == "yes") {
  116. RETRY_ARGS=$YMAKE_PYTHON ${input:"build/scripts/wrapcc.py"}
  117. }
  118. otherwise {
  119. RETRY_ARGS=
  120. }
  121. COVERAGE_FLAGS=
  122. EXTRA_OUTPUT=
  123. when ($CLANG == "yes" || $GCC == "yes") {
  124. when ($BUILD_TYPE == "COVERAGE" || $GCOV_COVERAGE) {
  125. COVERAGE_FLAGS=-fprofile-arcs -ftest-coverage
  126. EXTRA_OUTPUT=${output;noauto;hide;suf=${COMPILE_OUT_SUFFIX}${_CROSS_SUFFIX}.gcno:SRC}
  127. }
  128. }
  129. when ($OS_CYGWIN == "yes") {
  130. CFLAGS+=-D_LDBL_EQ_DBL=1 -U__STRICT_ANSI__
  131. USE_ASMLIB=no
  132. FSTACK=
  133. }
  134. CFLAGS+=$COVERAGE_FLAGS
  135. LDFLAGS+=$COVERAGE_FLAGS
  136. CHECKFLAG=
  137. NO_MAPREDUCE=
  138. when ($NO_MAPREDUCE == "yes") {
  139. C_DEFINES+=-DNO_MAPREDUCE
  140. }
  141. when ($OS_ANDROID == "yes") {
  142. PIE=yes
  143. }
  144. when ($CLANG && $OS_DARWIN && $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  145. SO_OUTPUTS=yes
  146. }
  147. when ($OS_NONE == "yes" || $MAPSMOBI_BUILD_TARGET == "yes" && $OS_LINUX != "yes") {
  148. USE_STL_SYSTEM=yes
  149. }
  150. # USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to
  151. # select system standard C++ library when USE_INTERNAL_STL=no is set.
  152. #
  153. # USE_STL_SYSTEM=yes is a regular way to select system standard C++ library.
  154. #
  155. when ($USE_STL_SYSTEM == "yes") {
  156. USE_INTERNAL_STL=no
  157. }
  158. when ($USE_INTERNAL_STL == "no") {
  159. USE_STL_SYSTEM=yes
  160. }
  161. otherwise {
  162. USE_INTERNAL_STL=yes
  163. # TODO: Extract to conf/sysincl.conf
  164. # This trigger doesn't work for module level since SYSINCL is processed at
  165. # configuration stage (This means that NO_RUNTIME() macro called in ya.make
  166. # won't affect SYSINCL and the only way to make this trigger work correctly
  167. # is to define configuration variable NORUNTIME (-DNORUNTIME) on the command
  168. # line when `ya make ...` is invoked.
  169. when ($NORUNTIME != "yes") {
  170. SYSINCL+=build/sysincl/stl-to-libcxx.yml
  171. when ($MUSL == "yes") {
  172. SYSINCL+=build/sysincl/libc-musl-libcxx.yml
  173. }
  174. }
  175. }
  176. # tag:linux-specific
  177. when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") {
  178. USE_UBUNTU_COMPATIBILITY=yes
  179. }
  180. USE_ARCADIA_PYTHON=yes
  181. USE_ARCADIA_LIBM=no
  182. USE_EAT_MY_DATA=no
  183. HAVE_MKL=
  184. when ($HAVE_MKL == "") {
  185. when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) {
  186. HAVE_MKL=yes
  187. }
  188. otherwise {
  189. HAVE_MKL=no
  190. }
  191. }
  192. SFDL_TMP_OUT= ${output;tmp:SRC.tmp}
  193. # tag:tool-specific
  194. ARCH_TOOL=${tool:"tools/archiver"}
  195. # tag:tool-specific tag:proto
  196. PROTOC=${tool:"contrib/tools/protoc"}
  197. PROTOC_STYLEGUIDE_OUT=--cpp_styleguide_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
  198. PROTOC_PLUGIN_STYLEGUIDE=--plugin=protoc-gen-cpp_styleguide=${tool:"contrib/tools/protoc/plugins/cpp_styleguide"}
  199. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf/src
  200. USE_VANILLA_PROTOC=no
  201. PROTOC_TRANSITIVE_HEADERS=yes
  202. _PROTOC_FLAGS=
  203. # tag:tool-specific
  204. FML_TOOL=${tool:"tools/relev_fml_codegen"}
  205. FML_UNUSED_TOOL=${tool:"tools/relev_fml_unused"}
  206. LUA_TOOL=${tool:"tools/lua"}
  207. ENUM_PARSER_TOOL=${tool:"tools/enum_parser/enum_parser"}
  208. # tag:python-specific tag:cython-specific
  209. CYTHON_SCRIPT=${input:"${ARCADIA_ROOT}/contrib/tools/cython/cython.py"} ${hide:CYTHON_FAKE_ID} $CYTHON_PREDEFINED_INCLUDES
  210. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON $CYTHON_SCRIPT
  211. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  212. PYTHON_TYPE_FOR_CYTHON=PY2
  213. CYTHON_OUTPUT_INCLUDES=\
  214. ${output_include;hide:"contrib/libs/python/Include/compile.h"} \
  215. ${output_include;hide:"contrib/libs/python/Include/frameobject.h"} \
  216. ${output_include;hide:"contrib/libs/python/Include/longintrepr.h"} \
  217. ${output_include;hide:"contrib/libs/python/Include/pyconfig.h"} \
  218. ${output_include;hide:"contrib/libs/python/Include/Python.h"} \
  219. ${output_include;hide:"contrib/libs/python/Include/pythread.h"} \
  220. ${output_include;hide:"contrib/libs/python/Include/structmember.h"} \
  221. ${output_include;hide:"contrib/libs/python/Include/traceback.h"} \
  222. ${output_include;hide:"contrib/tools/cython/generated_c_headers.h"} \
  223. ${output_include;hide:"omp.h"}
  224. # tag:cython-specific
  225. CYTHON_CPP_OUTPUT_INCLUDES=${output_include;hide:"contrib/tools/cython/generated_cpp_headers.h"}
  226. # tag:cython-specific
  227. CYTHON_PREDEFINED_INCLUDES=\
  228. ${input;hide:"contrib/tools/cython/Cython/Utility/Buffer.c"} \
  229. ${input;hide:"contrib/tools/cython/Cython/Utility/Builtins.c"} \
  230. ${input;hide:"contrib/tools/cython/Cython/Utility/CMath.c"} \
  231. ${input;hide:"contrib/tools/cython/Cython/Utility/Capsule.c"} \
  232. ${input;hide:"contrib/tools/cython/Cython/Utility/CommonTypes.c"} \
  233. ${input;hide:"contrib/tools/cython/Cython/Utility/Complex.c"} \
  234. ${input;hide:"contrib/tools/cython/Cython/Utility/Coroutine.c"} \
  235. ${input;hide:"contrib/tools/cython/Cython/Utility/CythonFunction.c"} \
  236. ${input;hide:"contrib/tools/cython/Cython/Utility/Embed.c"} \
  237. ${input;hide:"contrib/tools/cython/Cython/Utility/Exceptions.c"} \
  238. ${input;hide:"contrib/tools/cython/Cython/Utility/ExtensionTypes.c"} \
  239. ${input;hide:"contrib/tools/cython/Cython/Utility/FunctionArguments.c"} \
  240. ${input;hide:"contrib/tools/cython/Cython/Utility/ImportExport.c"} \
  241. ${input;hide:"contrib/tools/cython/Cython/Utility/MemoryView_C.c"} \
  242. ${input;hide:"contrib/tools/cython/Cython/Utility/ModuleSetupCode.c"} \
  243. ${input;hide:"contrib/tools/cython/Cython/Utility/ObjectHandling.c"} \
  244. ${input;hide:"contrib/tools/cython/Cython/Utility/Optimize.c"} \
  245. ${input;hide:"contrib/tools/cython/Cython/Utility/Overflow.c"} \
  246. ${input;hide:"contrib/tools/cython/Cython/Utility/Printing.c"} \
  247. ${input;hide:"contrib/tools/cython/Cython/Utility/Profile.c"} \
  248. ${input;hide:"contrib/tools/cython/Cython/Utility/StringTools.c"} \
  249. ${input;hide:"contrib/tools/cython/Cython/Utility/TestUtilityLoader.c"} \
  250. ${input;hide:"contrib/tools/cython/Cython/Utility/TypeConversion.c"}
  251. # tag:cython-specific
  252. CYTHON_PREDEFINED_INDUCED=\
  253. contrib/libs/python/Include/Python.h
  254. # tag:cython-specific
  255. CYTHON_OPTIONS=
  256. when ($OS_LINUX) {
  257. CYTHON_OPTIONS += -E UNAME_SYSNAME=Linux
  258. }
  259. elsewhen ($OS_DARWIN) {
  260. CYTHON_OPTIONS += -E UNAME_SYSNAME=Darwin
  261. }
  262. elsewhen ($OS_WINDOWS) {
  263. CYTHON_OPTIONS += -E UNAME_SYSNAME=Windows
  264. }
  265. FATAL_ERROR_MODULE=no
  266. FATAL_ERROR_MESSAGE=
  267. # tag:python-specific
  268. # PYTHON_DISTR={ "default" | "macos-brew" } determine python system supply
  269. # see build/platform/python/ya.make
  270. PYTHON_DISTR="default"
  271. when ($USE_SYSTEM_PYTHON) {
  272. USE_ARCADIA_PYTHON=no
  273. select ($USE_SYSTEM_PYTHON) {
  274. "2.7" ? {
  275. _SYSTEM_PYTHON27=yes
  276. PY_VERSION=2.7
  277. PY_FRAMEWORK_VERSION=2.7
  278. }
  279. "3.4" ? {
  280. _SYSTEM_PYTHON34=yes
  281. PY_VERSION=3.4m
  282. PY_FRAMEWORK_VERSION=3.4
  283. }
  284. "3.5" ? {
  285. _SYSTEM_PYTHON35=yes
  286. PY_VERSION=3.5m
  287. PY_FRAMEWORK_VERSION=3.5
  288. }
  289. "3.6" ? {
  290. _SYSTEM_PYTHON36=yes
  291. PY_VERSION=3.6m
  292. PY_FRAMEWORK_VERSION=3.6
  293. }
  294. "3.7" ? {
  295. _SYSTEM_PYTHON37=yes
  296. PY_VERSION=3.7m
  297. PY_FRAMEWORK_VERSION=3.7
  298. }
  299. "3.8" ? {
  300. _SYSTEM_PYTHON38=yes
  301. PY_VERSION=3.8
  302. PY_FRAMEWORK_VERSION=3.8
  303. }
  304. "3.9" ? {
  305. _SYSTEM_PYTHON39=yes
  306. PY_VERSION=3.9
  307. PY_FRAMEWORK_VERSION=3.9
  308. }
  309. "3.10" ? {
  310. _SYSTEM_PYTHON310=yes
  311. PY_VERSION=3.10
  312. PY_FRAMEWORK_VERSION=3.10
  313. }
  314. "3.11" ? {
  315. _SYSTEM_PYTHON311=yes
  316. PY_VERSION=3.11
  317. PY_FRAMEWORK_VERSION=3.11
  318. }
  319. default ? {
  320. FATAL_ERROR_MESSAGE+=invalid USE_SYSTEM_PYTHON value
  321. }
  322. }
  323. }
  324. ANTLR_PYTHON=Python2
  325. ### @usage: NO_LTO()
  326. ###
  327. ### Disable any lto (link-time optimizations) for the module.
  328. ### This will compile module source files as usual (without LTO) but will not prevent lto-enabled
  329. ### linking of entire program if global settings say so.
  330. macro NO_LTO() {
  331. DISABLE(USE_LTO)
  332. DISABLE(USE_THINLTO)
  333. }
  334. when ($BUILD_PYTHON3_BIN) {
  335. YMAKE_PYTHON3=${BUILD_PYTHON3_BIN}
  336. YMAKE_PYTHON3_PEERDIR=
  337. }
  338. otherwise {
  339. YMAKE_PYTHON3=${YMAKE_PYTHON3_RESOURCE_GLOBAL}/python3
  340. }
  341. # tag:python-specific
  342. when ($USE_ARCADIA_PYTHON == "no") {
  343. SYSINCL+=build/sysincl/python.yml
  344. }
  345. # tag:allocator
  346. DEFAULT_ALLOCATOR=LF
  347. # tag:allocator
  348. when ($OS_ANDROID == "yes" || $MSVC == "yes" || $ARCH_TYPE_32 == "yes" || $ARCH_AARCH64 == "yes") {
  349. DEFAULT_ALLOCATOR=J
  350. }
  351. # tag:allocator
  352. when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
  353. DEFAULT_ALLOCATOR=SYSTEM
  354. }
  355. # tag:allocator
  356. when ($OS_DARWIN == "yes") {
  357. DEFAULT_ALLOCATOR=SYSTEM
  358. }
  359. # tag:allocator
  360. when ($OS_LINUX == "yes") {
  361. when ($GCC) {
  362. # tcmalloc broken build
  363. }
  364. elsewhen ($SANDBOXING) {
  365. # broken
  366. }
  367. elsewhen ($ARCH_X86_64) {
  368. DEFAULT_ALLOCATOR=TCMALLOC_TC
  369. }
  370. }
  371. # tag:allocator
  372. when ($SANITIZER_TYPE) {
  373. when ($SANITIZER_TYPE != "no") {
  374. DEFAULT_ALLOCATOR=SYSTEM
  375. }
  376. }
  377. # tag:allocator
  378. when ($ARCH_XTENSA == "yes") {
  379. DEFAULT_ALLOCATOR=FAKE
  380. }
  381. # tag:internal
  382. ### @usage: CHECK_CONFIG_H(<conf_header>) # internal
  383. ###
  384. ### This internal macro adds checking code for configuration header in external (contrib) library.
  385. ### The check is needed to avoid conflicts on certain types and functions available in arcadia.
  386. ###
  387. ### @see https://a.yandex-team.ru/arc/trunk/arcadia/build/scripts/check_config_h.py for exact details
  388. macro CHECK_CONFIG_H(Conf) {
  389. .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"}
  390. OUTPUT_INCLUDES=$Conf
  391. }
  392. REQUIRED_TRANSITIVE_PEERS=
  393. ### @usage REQUIRES(dirs...)
  394. ###
  395. ### Specify list of dirs which this module must depend on indirectly.
  396. ###
  397. ### This macro can be used if module depends on the directories specified but they can't be listed
  398. ### as direct PEERDIR dependencies (due to public include order or link order issues).
  399. macro REQUIRES(DIRS[]) {
  400. SET_APPEND(REQUIRED_TRANSITIVE_PEERS $DIRS)
  401. }
  402. CHECK_DEPENDENT_DIRS_TYPES=
  403. CHECK_DEPENDENT_DIRS_RESTRICTIONS=
  404. ### @usage CHECK_DEPENDENT_DIRS(DENY|ALLOW_ONLY ([ALL|PEERDIRS|GLOB] dir)...)
  405. ###
  406. ### Specify project transitive dependencies constraints.
  407. ###
  408. ### @params:
  409. ### 1. DENY: current module can not depend on module from any specified directory neither directly nor transitively.
  410. ### 2. ALLOW_ONLY: current module can not depend on module from a dir not specified in the directory list neither directly nor transitively.
  411. ### 3. ALL: directory constraints following after this modifier are applied to both transitive PEERDIR dependencies and tool dependencies.
  412. ### 4. PEERDIRS: directory constraints following after this modifier are applied to transitive PEERDIR dependencies only.
  413. ### 5. GLOB: next directory constraint is an ANT glob pattern.
  414. ### 6. EXCEPT: next constraint is an exception for the rest of other rules.
  415. ###
  416. ### Directory constraints added before either ALL or PEERDIRS modifier is used are treated as ALL directory constraints.
  417. ###
  418. ### Note: Can be used multiple times on the same module all specified constraints will be checked.
  419. ### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
  420. macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RESTRICTIONS...) {
  421. SET_APPEND(CHECK_DEPENDENT_DIRS_RESTRICTIONS $PEERDIRS $RESTRICTIONS)
  422. SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
  423. }
  424. # tag:proto
  425. PY_PROTOS_FOR=no
  426. BUILD_PROTO_AS_EVLOG=no
  427. # tag:proto
  428. PROTO_NAMESPACE=
  429. # tag:proto tag:python-specific
  430. GEN_PY_PROTOS=$YMAKE_PYTHON ${input:"build/scripts/gen_py_protos.py"}
  431. # tag:proto tag:cpp-specific
  432. PROTO_HEADER_EXTS=.pb.h
  433. CPP_PROTO_CMDLINE=
  434. CPP_PROTO_OPTS=
  435. CPP_PROTO_OUTS=
  436. CPP_PROTO_OUTS_SEM=
  437. CPP_PROTO_SUFFIXES=.pb.h .pb.cc
  438. CPP_PROTO_PLUGINS=
  439. # tag:proto tag:cpp-specific
  440. CPP_EV_OPTS=--plugin=protoc-gen-event2cpp=${tool:"tools/event2cpp"} --event2cpp_out=$ARCADIA_BUILD_ROOT -I=$ARCADIA_ROOT/library/cpp/eventlog
  441. CPP_EV_OUTS=
  442. CPP_EV_OUTS_SEM=
  443. # tag:proto tag:python-specific
  444. PY_PROTO_OPTS=
  445. PY_PROTO_OUTS=
  446. PY_PROTO_OUTS_INTERNAL=
  447. PY_PROTO_DEPS=
  448. PY_PROTO_SUFFIXES=_pb2.py
  449. PY_EVLOG_SUFFIXES=_ev_pb2.py
  450. # tag:proto tag:java-specific
  451. JAVA_PROTO_ARGS=
  452. # tag:proto tag:python-specific
  453. OPTIMIZE_PY_PROTOS_FLAG=no
  454. macro _RESOURCE_SEM(INPUTS[], KEYS[]) {
  455. SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
  456. .SEM=resources ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS ${tool;hide:"tools/rescompiler/bin"}
  457. }
  458. # tag:built-in
  459. ### @usage: RESOURCE([FORCE_TEXT ][Src Key]* [- Key=Value]*) # built-in
  460. ### Add data (resources, random files, strings) to the program)
  461. ### 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.
  462. ### Alternative syntax with '- Key=Value' allows placing Value string as resource data into binary and make it accessible by Key.
  463. ###
  464. ### This is a simpler but less flexible option than ARCHIVE(), because in the case of ARCHIVE(), you have to use the data explicitly,
  465. ### and in the case of RESOURCE(), the data will fall through SRCS() or SRCS(GLOBAL) to binary linking.
  466. ###
  467. ### Use the FORCE_TEXT parameter to explicitly mark all Src files as text files: they will not be parsed unless used elsewhere.
  468. ###
  469. ### @example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a2ispolzujjtekomanduresource
  470. ###
  471. ### @example:
  472. ###
  473. ### LIBRARY()
  474. ### OWNER(user1)
  475. ###
  476. ### RESOURCE(
  477. ### path/to/file1 /key/in/program/1
  478. ### path/to/file2 /key2
  479. ### )
  480. ### END()
  481. ###
  482. macro RESOURCE(Args...) {
  483. PEERDIR(library/cpp/resource)
  484. }
  485. # tag:internal
  486. ### @usage: _ORDER_ADDINCL([BUILD ...] [SOURCE ...] Args...) # internal
  487. ###
  488. ### Order and filter ADDINCLs (Args - is intentionally omitted in ADDINCL macro)
  489. macro _ORDER_ADDINCL(BUILD[], SOURCE[], ARGS...) {
  490. ADDINCL($BUILD $SOURCE)
  491. }
  492. # tag:proto
  493. ### @usage: PROTO_ADDINCL([GLOBAL] [WITH_GEN] Path)
  494. ###
  495. ### This macro introduces proper ADDINCLs for .proto-files found in sources and
  496. ### .cpp/.h generated files, supplying them to appropriate commands and allowing
  497. ### proper dependency resolution at configure-time.
  498. ###
  499. ### Note: you normally shouldn't use this macro. ADDINCLs should be sent to user
  500. ### from dependency via PROTO_NAMESPACE macro
  501. macro PROTO_ADDINCL(GLOBAL?"GLOBAL":"", Path, WITH_GEN?"BUILD":"") {
  502. _ORDER_ADDINCL($WITH_GEN $GLOBAL FOR proto ${ARCADIA_BUILD_ROOT}/$Path SOURCE $GLOBAL FOR proto ${ARCADIA_ROOT}/$Path)
  503. ADDINCL($GLOBAL ${ARCADIA_BUILD_ROOT}/$Path)
  504. }
  505. # tag:proto
  506. ### @usage: PROTO_NAMESPACE([WITH_GEN] Namespace)
  507. ###
  508. ### Defines protobuf namespace (import/export path prefix) which should be used for imports and
  509. ### which defines output path for .proto generation.
  510. ###
  511. ### For proper importing and configure-time dependency management it sets ADDINCLs
  512. ### for both .cpp headers includes and .proto imports. If .proto expected to be used outside of the
  513. ### processing module use GLOBAL to send proper ADDINCLs to all (transitive) users. PEERDIR to
  514. ### PROTO_LIBRARY with PROTO_NAMESPACE() is enough at user side to correctly use the library.
  515. ### If generated .proto files are going to be used for building a module than use of WITH_GEN
  516. ### parameter will add appropriate dir from the build root for .proto files search.
  517. macro PROTO_NAMESPACE(GLOBAL?"GLOBAL":"", WITH_GEN?"WITH_GEN":"", Namespace) {
  518. SET(PROTO_NAMESPACE $Namespace)
  519. PROTO_ADDINCL(GLOBAL $WITH_GEN $Namespace)
  520. }
  521. # tag:proto
  522. ### @usage PROTOC_FATAL_WARNINGS()
  523. ###
  524. ### Treat protoc warnings as fatal errors that break the build, for example, unused imports
  525. ### Adds `--fatal_warnings` argument to protoc
  526. macro PROTOC_FATAL_WARNINGS() {
  527. SET_APPEND(_PROTOC_FLAGS --fatal_warnings)
  528. }
  529. # tag:proto tag:internal tag:python-specific
  530. ### @usage: OPTIMIZE_PY_PROTOS() # internal
  531. ###
  532. ### Enable Python proto optimization by embedding corresponding C++ code into binary.
  533. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  534. ### This is default mode for most PROTO_LIBRARY's and PY2_LIBRARY's, some system ones being exceptions.
  535. macro OPTIMIZE_PY_PROTOS() {
  536. SET(OPTIMIZE_PY_PROTOS_FLAG yes)
  537. }
  538. # tag:proto tag:python-specific
  539. ### @usage: NO_OPTIMIZE_PY_PROTOS()
  540. ###
  541. ### Disable Python proto optimization using embedding corresponding C++ code into binary.
  542. ### Python protobuf runtime will use C++ implementation instead of Python one if former is available.
  543. ### This is default mode only for some system libraries.
  544. macro NO_OPTIMIZE_PY_PROTOS() {
  545. SET(OPTIMIZE_PY_PROTOS_FLAG no)
  546. }
  547. # tag:proto tag:python-specific
  548. macro _PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  549. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/\$PROTO_NAMESPACE ${pre=--${Name}_opt=:OutParm}
  550. .SEM=IGNORED
  551. }
  552. # tag:proto tag:python-specific
  553. macro _ADD_PY_PROTO_OUT(Suf) {
  554. SET_APPEND(PY_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$Suf:File})
  555. SET_APPEND(PY_PROTO_OUTS_INTERNAL \${output;hide;noauto;norel;nopath;noext;suf=__int__$Suf:File} \${hide;kv:"ext_out_name_for_\${nopath;noext;suf=__int__$Suf:File} \${nopath;noext;suf=$Suf:File}"})
  556. # XXX fix variable expansion in plugins
  557. SET(PY_PROTO_SUFFIXES $PY_PROTO_SUFFIXES $Suf)
  558. }
  559. # tag:proto tag:python-specific
  560. ### @usage: PY_PROTO_PLUGIN(Name Ext Tool DEPS <Dependencies>)
  561. ###
  562. ### Define protoc plugin for python with given Name that emits extra output with provided Extension
  563. ### using Tool. Extra dependencies are passed via DEPS
  564. macro PY_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  565. SET_APPEND(PY_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  566. _ADD_PY_PROTO_OUT($EXT)
  567. # XXX fix variable expansion in plugins
  568. SET(PY_PROTO_DEPS $PY_PROTO_DEPS $DEPS)
  569. }
  570. # tag:proto tag:python-specific
  571. ### @usage: PY_PROTO_PLUGIN2(Name Ext1 Ext2 Tool DEPS <Dependencies>)
  572. ###
  573. ### Define protoc plugin for python with given Name that emits 2 extra outputs with provided Extensions
  574. ### using Tool. Extra dependencies are passed via DEPS
  575. macro PY_PROTO_PLUGIN2(NAME, EXT1, EXT2, TOOL, DEPS[]) {
  576. PY_PROTO_PLUGIN($NAME $EXT1 $TOOL DEPS $DEPS)
  577. _ADD_PY_PROTO_OUT($EXT2)
  578. }
  579. # tag:proto tag:java-specific
  580. macro _JAVA_PROTO_PLUGIN_ARGS_BASE(Name, Tool, OutParm...) {
  581. .CMD=--plugin=protoc-gen-${Name}=\${tool:"$Tool"} --${Name}_out=$ARCADIA_BUILD_ROOT/java_out
  582. }
  583. # tag:proto tag:java-specific
  584. ### @usage: JAVA_PROTO_PLUGIN(Name Tool DEPS <Dependencies>)
  585. ###
  586. ### Define protoc plugin for Java with given Name that emits extra outputs
  587. ### using Tool. Extra dependencies are passed via DEPS
  588. macro JAVA_PROTO_PLUGIN(NAME, TOOL, DEPS[]) {
  589. SET_APPEND(JAVA_PROTO_ARGS $_JAVA_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  590. # XXX fix variable expansion in plugins
  591. SET(JAVA_PROTOBUF_PEERS $JAVA_PROTOBUF_PEERS $DEPS)
  592. }
  593. macro _ADD_SEM_PROP_IF_NON_EMPTY(Prop, Args...) {
  594. .SEM=${pre=&& set_target_property $Prop :Args}
  595. }
  596. # tag:proto tag:cpp-specific
  597. macro _ADD_CPP_PROTO_OUT(Suf) {
  598. .SEM=append_target_property PROTOC_EXTRA_OUTS $Suf ${output;hide;suf=.o:Suf} $_ADD_SEM_PROP_IF_NON_EMPTY(PROTO_NAMESPACE $PROTO_NAMESPACE)
  599. SET_APPEND(CPP_PROTO_OUTS \${output;hide;norel;nopath;noext;suf=$Suf:File})
  600. # XXX fix variable expansion in plugins
  601. SET(CPP_PROTO_SUFFIXES $CPP_PROTO_SUFFIXES $Suf)
  602. }
  603. # tag:proto tag:cpp-specific
  604. HAS_CPP_PROTOBUF_PEERS=no
  605. CPP_PROTOBUF_PEERS=
  606. # tag:proto tag:cpp-specific
  607. ### @usage: CPP_PROTO_PLUGIN0(Name Tool DEPS <Dependencies>)
  608. ###
  609. ### Define protoc plugin for C++ with given Name that emits code into regular outputs
  610. ### using Tool. Extra dependencies are passed via DEPS.
  611. macro CPP_PROTO_PLUGIN0(NAME, TOOL, DEPS[]) {
  612. .SEM=target_proto_plugin $NAME ${tool;rootrel:TOOL} ${output;hide;suf=.fake.o:NAME}
  613. SET_APPEND(CPP_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  614. # XXX fix variable expansion in plugins
  615. ENABLE(HAS_CPP_PROTOBUF_PEERS)
  616. SET(CPP_PROTOBUF_PEERS $CPP_PROTOBUF_PEERS $DEPS)
  617. }
  618. # tag:proto tag:cpp-specific
  619. ### @usage: CPP_PROTO_PLUGIN(Name Tool Suf DEPS <Dependencies>)
  620. ###
  621. ### Define protoc plugin for C++ with given Name that emits code into 1 extra output
  622. ### using Tool. Extra dependencies are passed via DEPS.
  623. macro CPP_PROTO_PLUGIN(NAME, TOOL, SUF, DEPS[]) {
  624. CPP_PROTO_PLUGIN0($NAME $TOOL DEPS $DEPS)
  625. _ADD_CPP_PROTO_OUT($SUF)
  626. }
  627. # tag:proto tag:cpp-specific
  628. ### @usage: CPP_PROTO_PLUGIN2(Name Tool Suf1 Suf2 DEPS <Dependencies>)
  629. ###
  630. ### Define protoc plugin for C++ with given Name that emits code into 2 extra outputs
  631. ### using Tool. Extra dependencies are passed via DEPS.
  632. macro CPP_PROTO_PLUGIN2(NAME, TOOL, SUF1, SUF2, DEPS[]) {
  633. CPP_PROTO_PLUGIN($NAME $TOOL $SUF1 DEPS $DEPS)
  634. _ADD_CPP_PROTO_OUT($SUF2)
  635. SET_APPEND(CPP_PROTO_OUTS_SEM \${output;hide;norel;nopath;noext;suf=$SUF2:File})
  636. }
  637. # tag:proto
  638. ### @usage: USE_SKIFF() #wip, do not use
  639. ###
  640. ### Use mapreduce/yt/skiff_proto/plugin for C++
  641. macro USE_SKIFF() {
  642. # Move extra includes to INDUCED_DEPS macro in mapreduce/yt/skiff_proto/plugin/ya.make
  643. CPP_PROTO_PLUGIN0(skiff mapreduce/yt/skiff_proto/plugin DEPS mapreduce/yt/skiff_proto/lib)
  644. }
  645. # tag:go-specific
  646. _GO_COMMON_GOOGLE_APIS = \
  647. vendor/google.golang.org/genproto/googleapis/api/annotations \
  648. vendor/google.golang.org/genproto/googleapis/api/configchange \
  649. vendor/google.golang.org/genproto/googleapis/api/distribution \
  650. vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1 \
  651. vendor/google.golang.org/genproto/googleapis/api/expr/v1beta1 \
  652. vendor/google.golang.org/genproto/googleapis/api/httpbody \
  653. vendor/google.golang.org/genproto/googleapis/api/label \
  654. vendor/google.golang.org/genproto/googleapis/api/metric \
  655. vendor/google.golang.org/genproto/googleapis/api/monitoredres \
  656. vendor/google.golang.org/genproto/googleapis/api/serviceconfig \
  657. vendor/google.golang.org/genproto/googleapis/api/servicecontrol/v1 \
  658. vendor/google.golang.org/genproto/googleapis/api/servicemanagement/v1 \
  659. vendor/google.golang.org/genproto/googleapis/iam/admin/v1 \
  660. vendor/google.golang.org/genproto/googleapis/iam/credentials/v1 \
  661. vendor/google.golang.org/genproto/googleapis/iam/v1 \
  662. vendor/google.golang.org/genproto/googleapis/iam/v1/logging \
  663. vendor/google.golang.org/genproto/googleapis/logging/type \
  664. vendor/google.golang.org/genproto/googleapis/logging/v2 \
  665. vendor/google.golang.org/genproto/googleapis/rpc/code \
  666. vendor/google.golang.org/genproto/googleapis/rpc/errdetails \
  667. vendor/google.golang.org/genproto/googleapis/rpc/status \
  668. vendor/google.golang.org/genproto/googleapis/type/calendarperiod \
  669. vendor/google.golang.org/genproto/googleapis/type/color \
  670. vendor/google.golang.org/genproto/googleapis/type/date \
  671. vendor/google.golang.org/genproto/googleapis/type/dayofweek \
  672. vendor/google.golang.org/genproto/googleapis/type/expr \
  673. vendor/google.golang.org/genproto/googleapis/type/fraction \
  674. vendor/google.golang.org/genproto/googleapis/type/latlng \
  675. vendor/google.golang.org/genproto/googleapis/type/money \
  676. vendor/google.golang.org/genproto/googleapis/type/postaladdress \
  677. vendor/google.golang.org/genproto/googleapis/type/quaternion \
  678. vendor/google.golang.org/genproto/googleapis/type/timeofday
  679. # tag:go-specific
  680. _COMMON_GOOGLE_APIS=None
  681. # tag:go-specific
  682. ### @usage: USE_COMMON_GOOGLE_APIS([apis...])
  683. ###
  684. ### Use common-google-apis library set. Pass optional apis list to be used or use them all.
  685. ### This macro is properly handled for all languages including Go, where apis come in
  686. ## pregenerated form. In other languages apis are generated from sources in Arcadia.
  687. macro USE_COMMON_GOOGLE_APIS(APIS...) {
  688. SET(_COMMON_GOOGLE_APIS ${pre=vendor/google.golang.org/genproto/googleapis/:APIS})
  689. }
  690. # tag:go-specific tag:proto
  691. GO_PROTO_GEN_PLUGINS=
  692. GO_PROTO_OPTS=
  693. GO_PROTO_OUTS=
  694. GO_PROTO_GRPC_OPTS=
  695. GO_PROTO_GRPC_OUTS=
  696. GO_PROTO_V2=no
  697. _GO_PROTO_CHECK_OUTPUT=
  698. # tag:go-specific tag:proto
  699. GO_PROTOBUF_IMPORTS=\
  700. ${GOSTD}/sync \
  701. ${GOSTD}/reflect \
  702. ${GOSTD}/fmt \
  703. ${GOSTD}/math \
  704. vendor/github.com/golang/protobuf/proto \
  705. vendor/google.golang.org/protobuf/types/descriptorpb \
  706. vendor/google.golang.org/protobuf/runtime/protoimpl \
  707. vendor/google.golang.org/protobuf/runtime/protoiface \
  708. vendor/google.golang.org/protobuf/reflect/protoreflect
  709. # tag:go-specific tag:proto
  710. GO_PROTOBUF_WELLKNOWN_TYPES=\
  711. vendor/google.golang.org/protobuf/types/known/anypb \
  712. vendor/google.golang.org/protobuf/types/known/apipb \
  713. vendor/google.golang.org/protobuf/types/known/durationpb \
  714. vendor/google.golang.org/protobuf/types/known/emptypb \
  715. vendor/google.golang.org/protobuf/types/known/fieldmaskpb \
  716. vendor/google.golang.org/protobuf/types/known/sourcecontextpb \
  717. vendor/google.golang.org/protobuf/types/known/structpb \
  718. vendor/google.golang.org/protobuf/types/known/timestamppb \
  719. vendor/google.golang.org/protobuf/types/known/typepb \
  720. vendor/google.golang.org/protobuf/types/known/wrapperspb
  721. # tag:go-specific tag:proto
  722. ### @usage: GO_PROTO_PLUGIN(Name Ext Tool [DEPS dependencies...])
  723. ###
  724. ### Define protoc plugin for GO with given Name that emits extra output with provided extension
  725. ### Ext using Tool. Extra dependencies are passed via DEPS.
  726. macro GO_PROTO_PLUGIN(NAME, EXT, TOOL, DEPS[]) {
  727. SET_APPEND(GO_PROTO_OPTS $_PROTO_PLUGIN_ARGS_BASE($NAME $TOOL))
  728. SET_APPEND(GO_PROTO_OUTS \${output;hide;noauto;norel;nopath;noext;suf=$EXT:File})
  729. PEERDIR(${DEPS})
  730. }
  731. # tag:go-specific tag:proto
  732. GO_PROTO_CMDLINE=${cwd;rootdir;input:File} $YMAKE_PYTHON3 ${input:"build/scripts/go_proto_wrapper.py"} --arcadia-prefix $GO_ARCADIA_PROJECT_PREFIX --contrib-prefix $GO_CONTRIB_PROJECT_PREFIX --namespace ./$PROTO_NAMESPACE $_GO_PROTO_CHECK_OUTPUT --proto ${input;rootrel:File} -- $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH $_PROTOC_FLAGS
  733. # tag:go-specific tag:proto
  734. macro _GO_PROTO_CMD_IMPL(File, OPTS...) {
  735. .CMD=$GO_PROTO_CMDLINE $OPTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  736. .PEERDIR=${GO_PROTOBUF_IMPORTS} ${GO_PROTOBUF_WELLKNOWN_TYPES}
  737. .ADDINCL=FOR proto contrib/libs/protobuf/src
  738. }
  739. # tag:go-specific tag:proto
  740. macro _GO_PROTO_CMD(File) {
  741. .CMD=$_GO_PROTO_CMD_IMPL($File $GO_PROTO_OPTS $GO_PROTO_OUTS)
  742. }
  743. # tag:proto
  744. ### @usage: YP_PROTO_YSON(Files... OUT_OPTS Opts...)
  745. ###
  746. ### Generate .yson.go from .proto using yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen
  747. macro YP_PROTO_YSON(OUT_OPTS[], Files...) {
  748. .CMD=${cwd:BINDIR} $PROTOC --plugin=protoc-gen-custom=${tool:"yp/go/yson/internal/proto-yson-gen/cmd/proto-yson-gen"} -I=${ARCADIA_ROOT}/${PROTO_NAMESPACE} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} --custom_out="$OUT_OPTS paths=base_name:." --custom_opt="goroot=${GO_TOOLS_ROOT}" $_PROTOC_FLAGS ${input:Files} ${output;hide;noauto;nopath;noext;suf=.yson.go:Files}
  749. .ADDINCL=FOR proto ${ARCADIA_ROOT}/${MODDIR} FOR proto ${ARCADIA_ROOT}/${GO_TEST_IMPORT_PATH} FOR proto yt ${ARCADIA_BUILD_ROOT}/yt FOR proto contrib/libs/protobuf/src
  750. .PEERDIR=$GOSTD/strings $GOSTD/fmt $GOSTD/errors $GOSTD/encoding/json library/go/core/xerrors yt/go/yson yt/go/yterrors yp/go/yson/ytypes contrib/libs/protobuf
  751. }
  752. _SEM_CPP_PROTO_CMD=target_proto_messages PRIVATE ${input:File} $CPP_PROTO_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \
  753. && set_global_flags COMMON_PROTOC_FLAGS \
  754. && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT \
  755. && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH
  756. # tag:proto
  757. macro _CPP_PROTO_CMD(File) {
  758. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  759. .SEM=$_SEM_CPP_PROTO_CMD
  760. .PEERDIR=contrib/libs/protobuf
  761. }
  762. # tag:proto
  763. macro _CPP_VANILLA_PROTO_CMD(File) {
  764. .CMD=$CPP_PROTO_CMDLINE $CPP_PROTO_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  765. .PEERDIR=contrib/libs/protobuf_std
  766. }
  767. _SEM_CPP_EV_CMD=target_ev_messages PRIVATE ${input:File} $CPP_EV_OUTS_SEM ${output;hide;suf=${OBJ_SUF}.pb.o:File} ${hide;tool:"tools/event2cpp/bin"} ${hide;tool:"contrib/tools/protoc/bin"} ${hide;tool:"contrib/tools/protoc/plugins/cpp_styleguide"} \
  768. && set_global_flags COMMON_PROTOC_FLAGS \
  769. && target_proto_outs --cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $PROTOC_STYLEGUIDE_OUT --event2cpp_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE \
  770. && target_proto_addincls ./$PROTO_NAMESPACE $ARCADIA_ROOT/$PROTO_NAMESPACE ${_PROTO__INCLUDE} $ARCADIA_BUILD_ROOT $PROTOBUF_PATH $ARCADIA_ROOT/library/cpp/eventlog
  771. # tag:proto
  772. macro _CPP_EVLOG_CMD(File) {
  773. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_EV_OUTS ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  774. .SEM=$_SEM_CPP_EV_CMD
  775. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  776. }
  777. # tag:proto
  778. macro _CPP_PROTO_EVLOG_CMD(File) {
  779. # process .proto as .ev
  780. .CMD=$CPP_PROTO_CMDLINE $CPP_EV_OPTS $CPP_PROTO_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  781. .PEERDIR=library/cpp/eventlog contrib/libs/protobuf
  782. }
  783. # tag:proto
  784. macro _CPP_CFGPROTO_CMD(File) {
  785. # keep extension in output just as in EV: this is hard-coded behaviour of protoc for non-.proto extensions
  786. .CMD=$CPP_PROTO_CMDLINE --plugin=protoc-gen-config=${tool:"library/cpp/proto_config/plugin"} --config_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $CPP_EV_OUTS ${kv;hide:"p PB"} ${kv;hide:"pc yellow"}
  787. .PEERDIR=library/cpp/proto_config/codegen library/cpp/proto_config/protos contrib/libs/protobuf
  788. }
  789. # tag:proto
  790. PY_PROTO_MYPY_ENABLED=yes
  791. PY_PROTO_MYPY_PLUGIN_BASE=--plugin=protoc-gen-mypy=${tool:"contrib/python/mypy-protobuf/bin/protoc-gen-mypy"} --mypy_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE
  792. # tag:proto tag:python-specific
  793. PY_PROTO_MYPY_SUFFIX=
  794. PY_PROTO_MYPY_PLUGIN=
  795. PY_PROTO_MYPY_PLUGIN_INTERNAL=
  796. # tag:proto tag:python-specific
  797. macro NO_MYPY() {
  798. DISABLE(PY_PROTO_MYPY_ENABLED)
  799. }
  800. # tag:proto tag:python-specific
  801. macro _PY_PROTO_CMD_BASE(File, Suf, Args...) {
  802. .CMD=$PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --python_out=$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $_PROTOC_FLAGS ${input;rootrel:File} ${output;hide;noauto;norel;nopath;noext;suf=$Suf:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $Args
  803. }
  804. # tag:proto tag:python-specific
  805. macro _PY_PROTO_CMD(File) {
  806. .CMD=${cwd;rootdir;input:File} $_PY_PROTO_CMD_BASE($File _pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS $PY_PROTO_MYPY_PLUGIN)
  807. }
  808. # tag:proto tag:python-specific
  809. macro _PY_PROTO_CMD_INTERNAL(File) {
  810. .CMD=${cwd;rootdir;input:File} $GEN_PY_PROTOS --suffixes $PY_PROTO_SUFFIXES $PY_PROTO_MYPY_SUFFIX -- $_PY_PROTO_CMD_BASE($File __int___pb2.py $PY_PROTO_OPTS $PY_PROTO_OUTS_INTERNAL ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___pb2.py:File} ${nopath;noext;suf=_pb2.py:File}"} $PY_PROTO_MYPY_PLUGIN_INTERNAL)
  811. }
  812. # tag:proto tag:java-specific
  813. JAVA_PROTO_RUNTIME=
  814. # tag:proto tag:java-specific
  815. ### @usage: USE_JAVALITE()
  816. ### Use protobuf-javalite for Java
  817. macro USE_JAVALITE() {
  818. SET(JAVA_PROTO_RUNTIME javalite)
  819. }
  820. # tag:proto tag:java-specific
  821. JAVA_PROTO_RUNTIME_VERSION = 3.21.12
  822. JAVA_PROTO_COMMON_VERSION = 1.12.0
  823. KOTLIN_PROTO=no
  824. KOTLIN_PROTO_PEERS=
  825. when ($JAVA_PROTO_RUNTIME == "javalite") {
  826. _JAVA_PROTO_LITE_ARG=lite:
  827. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-javalite/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
  828. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.43.2
  829. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.43.2
  830. }
  831. otherwise {
  832. _JAVA_PROTO_LITE_ARG=
  833. JAVA_PROTOBUF_PEERS=contrib/java/com/google/protobuf/protobuf-java/${JAVA_PROTO_RUNTIME_VERSION} ${KOTLIN_PROTO_PEERS}
  834. JAVA_GRPC_STUB=contrib/java/io/grpc/grpc-stub/1.43.2
  835. JAVA_GRPC_PROTOBUF=contrib/java/io/grpc/grpc-protobuf/1.43.2
  836. }
  837. KOTLIN_PROTO_FLAGS=
  838. # tag:proto tag:java-specific
  839. macro _JAVA_PROTO_CMD(File) {
  840. .CMD=${cwd;rootdir;input:File} $YMAKE_PYTHON ${input:"build/scripts/tared_protoc.py"} --tar-output ${output;norel;nopath;noext;suf=.jsrc:File} --protoc-out-dir $ARCADIA_BUILD_ROOT/java_out $PROTOC -I=./$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_ROOT --java_out=${_JAVA_PROTO_LITE_ARG}$ARCADIA_BUILD_ROOT/java_out ${KOTLIN_PROTO_FLAGS} $_PROTOC_FLAGS ${input;rootrel:File} ${kv;hide:"p PB"} ${kv;hide:"pc yellow"} $JAVA_PROTO_ARGS
  841. .SEM=proto_files ${input;rootrel:File} ${hide;output:File.jsrc}
  842. }
  843. # tag:proto tag:perl-specific tag:deprecated
  844. ### @usage: XS_PROTO(InputProto Dir Outputs...) # deprecated
  845. ###
  846. ### Generate Perl code from protobuf.
  847. ### In order to use this macro one should predict all outputs protoc will emit from input_proto file and enlist those as outputs.
  848. macro XS_PROTO(File, Dir, Outputs...) {
  849. .CMD=$PROTOC -I=${ARCADIA_ROOT}/${Dir} ${pre=-I=:_PROTO__INCLUDE} -I=${ARCADIA_ROOT} -I=${PROTOBUF_PATH} --perlxs_out=${BINDIR} $_PROTOC_FLAGS ${input:File} ${hide;output:Outputs} ${induced_deps=h+cpp;hide;nopath;noext;suf=.pb.h:File}
  850. PEERDIR(${Dir})
  851. ADDINCL(${ARCADIA_BUILD_ROOT}/${Dir})
  852. }
  853. # tag:proto tag:fbs
  854. ### @usage: PROTO2FBS(InputProto)
  855. ###
  856. ### Produce flatbuf schema out of protobuf description.
  857. macro PROTO2FBS(File) {
  858. .CMD=${cwd:BINDIR} ${tool:"contrib/tools/flatc"} -I . -I ${ARCADIA_ROOT} --proto ${input:File} ${output;hide;norel;noext:File.fbs} ${kv;hide:"p FBS"} ${kv;hide:"pc yellow"} && $MOVE_FILE ${BINDIR}/${nopath;noext:File.fbs} ${output;norel;noext:File.fbs}
  859. }
  860. # tag:proto tag:python-specific
  861. when ($PY_PROTOS_FOR == "yes") {
  862. PEERDIR+=contrib/libs/protobuf/python
  863. }
  864. # tag:python-specific
  865. macro _PY_EVLOG_CMD_BASE(File, Suf, Args...) {
  866. .CMD=$_PY_PROTO_CMD_BASE($File $Suf $Args)
  867. .PEERDIR=library/cpp/eventlog/proto
  868. }
  869. # tag:python-specific tag:proto
  870. macro _PY_EVLOG_CMD(File) {
  871. .CMD=${cwd;rootdir;input:File} $_PY_EVLOG_CMD_BASE($File _ev_pb2.py)
  872. }
  873. # tag:python-specific tag:proto
  874. macro _PY_EVLOG_CMD_INTERNAL(File) {
  875. .CMD=${cwd;rootdir;input:File} $GEN_PY_PROTOS --suffixes $PY_EVLOG_SUFFIXES -- $_PY_EVLOG_CMD_BASE($File __int___ev_pb2.py ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___ev_pb2.py:File} ${nopath;noext;suf=_ev_pb2.py:File}"})
  876. }
  877. # tag:java-specific tag:proto
  878. macro _JAVA_EVLOG_CMD(File) {
  879. .CMD=$COPY_CMD ${input:File} ${output;nopath;noext;norel;suf=_ev.proto:File} ${kv;hide:"p EV"} ${kv;hide:"pc yellow"}
  880. .PEERDIR=library/cpp/eventlog/proto
  881. }
  882. # tag:sanitize
  883. RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
  884. # tag:sanitize
  885. when ($IS_CROSS_SANITIZE) {
  886. RUN_NO_SANITIZE=
  887. }
  888. YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args
  889. XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args
  890. WRITER_PY=$YMAKE_PYTHON ${input:"build/scripts/writer.py"} ${input;hide:"build/scripts/process_command_files.py"}
  891. FS_TOOLS=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"} ${input;hide:"build/scripts/process_command_files.py"}
  892. FIX_MSVC_OUTPUT=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ${input;hide:"build/scripts/process_command_files.py"}
  893. _PROCESS_WHOLE_ARCHIVE_SCRIPT=${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/process_whole_archive_option.py"}
  894. COPY_CMD=$FS_TOOLS copy
  895. LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy
  896. REMOVE_FILE=$FS_TOOLS remove
  897. MOVE_FILE=$FS_TOOLS rename
  898. # tag:allocator tag:windows-specific
  899. MSVC_DYNAMICBASE=/DYNAMICBASE
  900. when ($ALLOCATOR == "LF") {
  901. MSVC_DYNAMICBASE=/DYNAMICBASE:NO
  902. }
  903. # tag:sanitize
  904. SANITIZER_CFLAGS=
  905. # tag:proto tag:grpc
  906. _GRPC_ENABLED=no
  907. # tag:proto tag:grpc
  908. ### @usage: GRPC()
  909. ###
  910. ### Emit GRPC code for all .proto files in a PROTO_LIBRARY.
  911. ### This works for all available PROTO_LIBRARY versions (C++, Python 2.x, Python 3.x, Java and Go).
  912. macro GRPC() {
  913. ENABLE(_GRPC_ENABLED)
  914. # C++
  915. CPP_PROTO_PLUGIN2(grpc_cpp contrib/tools/protoc/plugins/grpc_cpp .grpc.pb.cc .grpc.pb.h DEPS contrib/libs/grpc)
  916. # Python
  917. PY_PROTO_PLUGIN(grpc_py _pb2_grpc.py contrib/tools/protoc/plugins/grpc_python DEPS contrib/python/grpcio)
  918. # Java
  919. JAVA_PROTO_PLUGIN(grpc_java contrib/tools/protoc/plugins/grpc_java DEPS $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF)
  920. SET_APPEND(JAVA_PROTOBUF_PEERS contrib/java/javax/annotation/javax.annotation-api/1.3.1)
  921. }
  922. macro GO_PROTO_USE_V2() {
  923. ENABLE(GO_PROTO_V2)
  924. }
  925. # tag:fbs
  926. FLATC_FLAGS_VALUE=
  927. ### @usage: FLATC_FLAGS(flags...)
  928. ###
  929. ### Add flags to flatc command line
  930. macro FLATC_FLAGS(FLAGS...) {
  931. SET_APPEND(FLATC_FLAGS_VALUE $FLAGS)
  932. }
  933. # tag:fbs
  934. _PY_FBS_DEPS=contrib/python/flatbuffers
  935. # tag:fbs tag:internal
  936. ### @usage: FBS_TO_PYSRC(output_base_name fbs_files...) # internal
  937. ###
  938. ### Create a tar archive of .py files generated by flatc for Python. Output tar
  939. ### archive will have .fbs.pysrc extension. This .fbs.pysrc extension is specially
  940. ### processed when --add-flatbuf-result flag is specified on the command line
  941. ### for 'ya make ...' (tar archive is extracted to output directory).
  942. macro FBS_TO_PYSRC(OUT_NAME, IN_FBS_FILES...) {
  943. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --python --gen-mutable ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR} ${input:IN_FBS_FILES} && $YMAKE_PYTHON3 ${input:"build/scripts/tar_sources.py"} --exts .py --input $BINDIR --output ${output;noauto;tared:OUT_NAME.fbs.pysrc} ${kv;hide:"p FP"} ${kv;hide:"pc light-green"} ${kv;hide:"tared_kind nodir"}
  944. }
  945. # tag:fbs tag:go-specific
  946. # Implicit dependencies of generated code for Go
  947. _GO_FLATC_IMPORTS=\
  948. ${GOSTD}/strconv \
  949. vendor/github.com/google/flatbuffers/go
  950. # tag:fbs tag:cpp-specific
  951. macro _CPP_FLATC_CMD(SRC, SRCFLAGS...) {
  952. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${input:"build/scripts/cpp_flatc_wrapper.py"} ${tool:"contrib/tools/flatc"} --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --yandex-maps-iter --gen-object-api --filename-suffix .fbs ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${output;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${input:SRC} ${output;hide;noext;norel:SRC.iter.fbs.h} ${output;noauto;hide;noext;norel:SRC.bfbs} ${kv;hide:"p FL"} ${kv;hide:"pc light-green"}
  953. .SEM=target_fbs_source PRIVATE ${input:SRC} ${pre=-I :_FLATC__INCLUDE} ${output;hide;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${output;hide;noext;norel:SRC.iter.fbs.h} ${output;noauto;hide;noext;norel:SRC.bfbs} ${hide;tool:"contrib/tools/flatc/bin"} && set_global_flags FBS_CPP_FLAGS --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --yandex-maps-iter --gen-object-api --filename-suffix .fbs ${FLATC_FLAGS_VALUE} ${input;hide:"build/scripts/cpp_flatc_wrapper.py"}
  954. .PEERDIR=contrib/libs/flatbuffers
  955. }
  956. # tag:fbs tag:cpp-specific
  957. macro _CPP_FLATC64_CMD(SRC, SRCFLAGS...) {
  958. .CMD=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON3 ${input:"build/scripts/cpp_flatc_wrapper.py"} ${tool:"contrib/tools/flatc64"} --no-warnings --cpp --keep-prefix --gen-mutable --schema -b --filename-suffix .fbs64 ${FLATC_FLAGS_VALUE} -I ${ARCADIA_ROOT} -I ${ARCADIA_BUILD_ROOT} -o ${output;norel:SRC.h} ${output;hide;norel:SRC.cpp} ${input:SRC} ${output;noauto;hide;noext;norel:SRC.bfbs64} ${kv;hide:"p FL64"} ${kv;hide:"pc light-green"}
  959. .PEERDIR=contrib/libs/flatbuffers64
  960. }
  961. # tag:fbs tag:go-specific tag:internal
  962. ### @usage: _GO_FLATC_CMD(fbs_file flags...) # internal
  963. ###
  964. ### Create a tar archive of .go files generated by flatc for Go. Output tar archive
  965. ### will have .fbs.gosrc extension. This .fbs.gosrc is specially processed when
  966. ### --add-protobuf-result flag is specified on the command line for 'ya make ...'
  967. ### (tar archive is extracted to output directory).
  968. macro _GO_FLATC_CMD(SRC, PACKAGE_NAME) {
  969. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --go --gen-mutable --go-namespace ${PACKAGE_NAME} ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR}/_generated ${input:SRC} && $YMAKE_PYTHON3 ${input:"build/scripts/postprocess_go_fbs.py"} --input-dir ${BINDIR} --map $_FBS_NAMESPACE_MAP_GLOBAL && $YMAKE_PYTHON3 ${input:"build/scripts/tar_sources.py"} --flat --input ${BINDIR}/_generated --output ${output;noext;tared:SRC.fbs.gosrc} --exts .go ${kv;hide:"p FG"} ${kv;hide:"pc light-green"} ${kv;hide:"tared_kind nodir"}
  970. .PEERDIR=${_GO_FLATC_IMPORTS}
  971. }
  972. # tag:fbs tag:java-specific tag:internal
  973. ### @usage: _JAVA_FLATC_CMD(fbs_file) # internal
  974. ###
  975. ### Create a tar archive of .java files generated by flatc for Java. Output tar
  976. ### acrchive will have .fbs.jsrc extension. Files with .fbs.jsrc extension will
  977. ### be added to results when --add-flatbuf-result flag is specified on the command
  978. ### line for 'ya make ...'
  979. macro _JAVA_FLATC_CMD(SRC) {
  980. .CMD=${cwd:ARCADIA_BUILD_ROOT} ${tool:"contrib/tools/flatc"} --java --gen-mutable ${FLATC_FLAGS_VALUE} ${pre=-I :_FLATC__INCLUDE} -o ${BINDIR} ${input:SRC} && $YMAKE_PYTHON3 ${input:"build/scripts/tar_sources.py"} --input $BINDIR --output ${output;nopath;noext:SRC.fbs.jsrc} --exts .java ${kv;hide:"p FJ"} ${kv;hide:"pc light-green"}
  981. .PEERDIR=contrib/java/com/google/flatbuffers/flatbuffers-java/${JAVA_FLATBUFFERS_VERSION}
  982. }
  983. # variables must be defined for all module types to make generate_mf.py work
  984. MODULE_PREFIX=
  985. MODULE_SUFFIX=
  986. NEED_PLATFORM_PEERDIRS=yes
  987. PEERDIR_TEST_TOOL=yes
  988. # tag:python-specific
  989. PYTHON2=no
  990. PYTHON3=no
  991. # tag:python-specific
  992. when (!$ARCADIA_PYTHON_UNICODE_SIZE) {
  993. when ($OS_WINDOWS) {
  994. ARCADIA_PYTHON_UNICODE_SIZE=2
  995. }
  996. otherwise {
  997. ARCADIA_PYTHON_UNICODE_SIZE=4
  998. }
  999. }
  1000. YMAKE_PYTHON3_PEERDIR=build/platform/python/ymake_python3
  1001. macro NO_YMAKE_PYTHON3() {
  1002. SET(YMAKE_PYTHON3_PEERDIR)
  1003. }
  1004. ### @usage: _BARE_UNIT # internal
  1005. ###
  1006. ### The base of all modules describing default bare minimum for all modules.
  1007. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1008. module _BARE_UNIT {
  1009. .EXTS=.*
  1010. .CMD=TOUCH_UNIT
  1011. .IGNORED=GO_PROTO_PLUGIN
  1012. .NODE_TYPE=Bundle
  1013. .PEERDIR_POLICY=as_include
  1014. .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
  1015. .FINAL_TARGET=no
  1016. PEERDIR_TAGS=__EMPTY__
  1017. PEERDIR+=$YMAKE_PYTHON3_PEERDIR
  1018. when ($FATAL_ERROR_MESSAGE && $FATAL_ERROR_MODULE != "yes") {
  1019. PEERDIR+=build/conf_fatal_error
  1020. }
  1021. DEFAULT(MODULE_VERSION)
  1022. DEFAULT(MODULE_PREFIX)
  1023. DEFAULT(MODULE_SUFFIX)
  1024. }
  1025. ### @usage: GEN_LIBRARY()
  1026. ###
  1027. ### Definition of a module that brings generated artefacts. This module can PEERDIRed
  1028. ### from any module. The resulted module is empty and cleaned up during construction
  1029. ### of the build graph.
  1030. ###
  1031. ### NOTE! SRCS macro is not supported for this library.
  1032. module GEN_LIBRARY: _BARE_UNIT {
  1033. .PROXY=yes
  1034. .RESTRICTED=SRCS SRC
  1035. .SEM=IGNORED
  1036. # ENABLE(_FAKE_MODULE)
  1037. SET(MODULE_SUFFIX .pkg.fake)
  1038. }
  1039. ### @usage: _BASE_UNIT # internal
  1040. ###
  1041. ### The base of all LIBRARY/PROGRAM modules describing common logic for all modules.
  1042. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  1043. module _BASE_UNIT: _BARE_UNIT {
  1044. .GLOBAL=_FBS_NAMESPACE_MAP
  1045. PEERDIR_TAGS=CPP_PROTO CPP_FBS H_IDL PY2 PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB
  1046. 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}
  1047. CPP_PROTO_OUTS+=${output;hide;norel;nopath;noext:File.pb.cc} ${output;main;hide;norel;nopath;noext:File.pb.h}
  1048. CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.pb.h}
  1049. CPP_EV_OUTS+=${output;hide;norel:File.pb.cc} ${output;hide;norel:File.pb.h}
  1050. CPP_EV_OUTS_SEM+=${output;hide;norel:File.pb.h}
  1051. when ($SWIG_LANG == "perl") {
  1052. _SWIG_CMD=$_SWIG_PERL_CMD
  1053. _SWIG_ADDINCLS=$_SWIG_PERL_ADDINCLS
  1054. _SWIG_PEERDIR=$_SWIG_PERL_PEERDIR
  1055. }
  1056. elsewhen ($SWIG_LANG == "python") {
  1057. _SWIG_CMD=$_SWIG_PYTHON_CMD
  1058. _SWIG_ADDINCLS=$_SWIG_PYTHON_ADDINCLS
  1059. _SWIG_PEERDIR=$_SWIG_PYTHON_PEERDIR
  1060. }
  1061. elsewhen ($SWIG_LANG == "jni_cpp") {
  1062. _SWIG_CMD=$_SWIG_JNI_CPP_CMD
  1063. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1064. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1065. }
  1066. elsewhen ($SWIG_LANG == "java") {
  1067. _SWIG_CMD=$_SWIG_JNI_CMD
  1068. _SWIG_ADDINCLS=$_SWIG_JNI_ADDINCLS
  1069. _SWIG_PEERDIR=$_SWIG_JNI_PEERDIR
  1070. }
  1071. when ($PY_PROTOS_FOR == "yes") {
  1072. MACRO_ALIAS(EVLOG_CMD _PY_EVLOG_CMD)
  1073. MACRO_ALIAS(PROTO_CMD _PY_PROTO_CMD)
  1074. }
  1075. otherwise {
  1076. MACRO_ALIAS(EVLOG_CMD _CPP_EVLOG_CMD)
  1077. MACRO_ALIAS(FBS_CMD _CPP_FLATC_CMD)
  1078. when ($BUILD_PROTO_AS_EVLOG == "yes") {
  1079. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_EVLOG_CMD)
  1080. }
  1081. otherwise {
  1082. MACRO_ALIAS(PROTO_CMD _CPP_PROTO_CMD)
  1083. }
  1084. when ($USE_VANILLA_PROTOC == "yes") {
  1085. PROTOC=${tool:"contrib/tools/protoc_std"}
  1086. PROTOC_STYLEGUIDE_OUT=
  1087. PROTOC_PLUGIN_STYLEGUIDE=
  1088. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std
  1089. MACRO_ALIAS(PROTO_CMD _CPP_VANILLA_PROTO_CMD)
  1090. }
  1091. when ($PROTOC_TRANSITIVE_HEADERS == "no") {
  1092. CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
  1093. }
  1094. }
  1095. SANITIZER_DEFINED=no
  1096. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  1097. CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer
  1098. LDFLAGS+=-fsanitize=$SANITIZER_TYPE
  1099. SANITIZER_DEFINED=yes
  1100. when ($CLANG) {
  1101. CFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  1102. LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  1103. }
  1104. }
  1105. when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") {
  1106. CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1107. LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  1108. }
  1109. POPULATE_CPP_COVERAGE_FLAGS()
  1110. when ($NLG_COVERAGE && $NLG_COVERAGE != "no") {
  1111. CFLAGS+=-DNLG_COVERAGE
  1112. }
  1113. when ($GCC) {
  1114. select ($SANITIZER_TYPE) {
  1115. "address" ? {
  1116. LDFLAGS+=-static-libasan
  1117. }
  1118. "undefined" ? {
  1119. LDFLAGS+=-static-libubsan
  1120. }
  1121. "thread" ? {
  1122. PIE=yes
  1123. LDFLAGS+=-static-libtsan
  1124. }
  1125. }
  1126. }
  1127. when ($HARDENING == "yes") {
  1128. when ($CLANG) {
  1129. CFLAGS+=-fstack-protector-all -D_hardening_enabled_
  1130. LDFLAGS+=-z relro -z now -z noexecstack
  1131. PIE=yes
  1132. }
  1133. }
  1134. when ($USE_LTO == "yes") {
  1135. when ($GCC) {
  1136. CFLAGS+=-flto -fno-fat-lto-objects
  1137. LDFLAGS+=-flto
  1138. NO_LTO_CFLAGS=-fno-lto
  1139. }
  1140. when ($CLANG) {
  1141. CFLAGS+=-flto
  1142. LDFLAGS+=-flto
  1143. NO_LTO_CFLAGS=-fno-lto
  1144. }
  1145. }
  1146. when ($USE_THINLTO == "yes") {
  1147. when ($GCC) {
  1148. CFLAGS+=-flto=thin
  1149. LDFLAGS+=-flto=thin
  1150. NO_LTO_CFLAGS=-fno-lto
  1151. }
  1152. when ($CLANG) {
  1153. CFLAGS+=-flto=thin
  1154. LDFLAGS+=-flto=thin
  1155. NO_LTO_CFLAGS=-fno-lto
  1156. }
  1157. }
  1158. when ($CLANG) {
  1159. when ($PGO_ADD == "yes") {
  1160. CFLAGS+=-fprofile-instr-generate
  1161. LDFLAGS+=-fprofile-instr-generate
  1162. }
  1163. when ($PGO_PATH) {
  1164. CFLAGS+=-fprofile-instr-use=$PGO_PATH -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date
  1165. LDFLAGS+=-fprofile-instr-use=$PGO_PATH
  1166. }
  1167. }
  1168. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  1169. PEERDIR+=$COMPILER_PLATFORM
  1170. }
  1171. when ($OS_LINUX && $NEED_PLATFORM_PEERDIRS == "yes") {
  1172. PEERDIR+=contrib/libs/linux-headers
  1173. }
  1174. # Adding PEERDIR from trigger doesn't always work. In this case it
  1175. # cause troubles in contrib/libs/libc_compat/ubuntu_14 under musl
  1176. # Workaround this issue by setting variable with PEERDIR in trigger
  1177. # and then adding PEERDIR to it's value unconditionally.
  1178. when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1179. _UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14
  1180. }
  1181. otherwise {
  1182. _UBUNTU_COMPAT_PEERDIR=
  1183. }
  1184. PEERDIR+=$_UBUNTU_COMPAT_PEERDIR
  1185. when ($NORUNTIME != "yes") {
  1186. PEERDIR+=contrib/libs/cxxsupp
  1187. when ($MAPSMOBI_BUILD_TARGET == "yes") {
  1188. PEERDIR+=build/platform/mapkit
  1189. }
  1190. }
  1191. when ($NOUTIL != "yes") {
  1192. PEERDIR+=util
  1193. }
  1194. when ($MUSL == "yes") {
  1195. CFLAGS += -D_musl_
  1196. LINK_DYN_LIB_FLAGS += --musl
  1197. LINK_SCRIPT_EXE_FLAGS += --musl
  1198. PEERDIR+=contrib/libs/musl/include
  1199. }
  1200. # g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
  1201. # The same problem exists for clang toolchain. On the other hand, the problem
  1202. # doesn't affect cl since it has united C/C++ library and doesn't need
  1203. # proxy C-headers.
  1204. # Disable all C++ headers including proxy C-headers when we use libc++.
  1205. when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
  1206. CXXFLAGS += -nostdinc++
  1207. }
  1208. otherwise {
  1209. CFLAGS += -DUSE_STL_SYSTEM
  1210. }
  1211. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  1212. PEERDIR += build/external_resources/codenavigation
  1213. }
  1214. when ($CYTHON_COVERAGE && $CYTHON_COVERAGE == "yes") {
  1215. CFLAGS+=-DCYTHON_TRACE=1 -DCYTHON_TRACE_NOGIL=1
  1216. }
  1217. DEFAULT(USE_SSE4 yes)
  1218. when ($NOSSE != "yes") {
  1219. CFLAGS+=$SSE_CFLAGS
  1220. C_DEFINES+=$SSE_DEFINES
  1221. when ($USE_SSE4 == "yes") {
  1222. CFLAGS+=$SSE4_CFLAGS
  1223. C_DEFINES+=$SSE4_DEFINES
  1224. }
  1225. }
  1226. elsewhen ($MSVC != "yes") {
  1227. CFLAGS += -mno-sse
  1228. }
  1229. POPULATE_CPP_COVERAGE_FLAGS()
  1230. _REGISTER_NO_CHECK_IMPORTS()
  1231. DEFAULT(PACKAGE_PREFIX_ARGS)
  1232. DEFAULT(SWIG_LANG python)
  1233. DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
  1234. when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") {
  1235. PEERDIR+=build/platform/binutils
  1236. }
  1237. }
  1238. _LINKER_ID=
  1239. # GCC does not support -fuse-ld with an executable path,
  1240. # only -fuse-ld=gold or -fuse-ld=lld.
  1241. when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  1242. when ($_LINKER_ID in [ "gold", "lld" ]) {
  1243. PEERDIR+=build/platform/${_LINKER_ID}
  1244. }
  1245. }
  1246. macro _USE_LINKER_IMPL(LINKER_ID...) {
  1247. SET(_LINKER_ID $LINKER_ID)
  1248. }
  1249. macro _USE_LINKER() {
  1250. _USE_LINKER_IMPL($_DEFAULT_LINKER_ID)
  1251. }
  1252. ### @usage: USE_LINKER_GOLD()
  1253. ### Use gold linker for a program. This doesn't work in libraries
  1254. macro USE_LINKER_GOLD() {
  1255. _USE_LINKER_IMPL(gold)
  1256. }
  1257. COMMON_LINK_SETTINGS=
  1258. LINK_ADDITIONAL_SECTIONS=
  1259. LINK_ADDITIONAL_SECTIONS_COMMAND=
  1260. when ($COMMON_LINK_SETTINGS == "yes") {
  1261. when ($_LINKER_ID == "lld" && ($OS_LINUX == "yes" || $OS_ANDROID == "yes")) {
  1262. LDFLAGS += -Wl,--gdb-index
  1263. }
  1264. when ($EMBED_LINKER_CREF == "yes") {
  1265. LDFLAGS+=-Wl,--cref ${tmp;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1266. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_cref=${tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME}
  1267. }
  1268. elsewhen ($DUMP_LINKER_CREF == "yes") {
  1269. LDFLAGS+=-Wl,--cref ${output;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  1270. }
  1271. when ($EMBED_LINKER_MAP == "yes") {
  1272. LDFLAGS+=-Wl,-Map=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1273. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_map.${_LINKER_ID}=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1274. }
  1275. elsewhen ($DUMP_LINKER_MAP == "yes") {
  1276. LDFLAGS+=-Wl,-Map=${output;rootrel;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  1277. }
  1278. when ($USE_MKL == "yes") {
  1279. NOPLATFORM=yes
  1280. }
  1281. when (($USE_EAT_MY_DATA == "yes") && ($WIN32 != "yes") && ($DARWIN != "yes") && ($OS_ANDROID != "yes") && ($OS_IOS != "yes")) {
  1282. PEERDIR+=contrib/libs/libeatmydata/autocheck_wrapper
  1283. }
  1284. when ($USE_ARCADIA_LIBM == "yes") {
  1285. PEERDIR+=contrib/libs/libm
  1286. }
  1287. when ($USE_ARCADIA_LIBM == "no") {
  1288. C_SYSTEM_LIBRARIES+=-lm
  1289. }
  1290. when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") {
  1291. 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" ]) {
  1292. PEERDIR+=library/cpp/malloc/system
  1293. }
  1294. }
  1295. otherwise {
  1296. select ($ALLOCATOR) {
  1297. "MIM" ? {
  1298. PEERDIR+=library/cpp/malloc/mimalloc
  1299. }
  1300. "HU" ? {
  1301. PEERDIR+=library/cpp/malloc/hu
  1302. }
  1303. "PROFILED_HU" ? {
  1304. PEERDIR+=library/cpp/malloc/profiled_hu
  1305. }
  1306. "TCMALLOC_256K" ? {
  1307. PEERDIR+=library/cpp/malloc/tcmalloc
  1308. PEERDIR+=contrib/libs/tcmalloc
  1309. }
  1310. "TCMALLOC_SMALL_BUT_SLOW" ? {
  1311. PEERDIR+=library/cpp/malloc/tcmalloc
  1312. PEERDIR+=contrib/libs/tcmalloc/small_but_slow
  1313. }
  1314. "TCMALLOC_NUMA_256K" ? {
  1315. PEERDIR+=library/cpp/malloc/tcmalloc
  1316. PEERDIR+=contrib/libs/tcmalloc/numa_256k
  1317. }
  1318. "TCMALLOC_NUMA_LARGE_PAGES" ? {
  1319. PEERDIR+=library/cpp/malloc/tcmalloc
  1320. PEERDIR+=contrib/libs/tcmalloc/numa_large_pages
  1321. }
  1322. "TCMALLOC" ? {
  1323. PEERDIR+=library/cpp/malloc/tcmalloc
  1324. PEERDIR+=contrib/libs/tcmalloc/default
  1325. }
  1326. "TCMALLOC_TC" ? {
  1327. PEERDIR+=library/cpp/malloc/tcmalloc
  1328. PEERDIR+=contrib/libs/tcmalloc/no_percpu_cache
  1329. }
  1330. "GOOGLE" ? {
  1331. PEERDIR+=library/cpp/malloc/galloc
  1332. }
  1333. "J" ? {
  1334. when ($WIN32 == "yes") {
  1335. PEERDIR+=library/cpp/malloc/system
  1336. }
  1337. otherwise {
  1338. PEERDIR+=library/cpp/malloc/jemalloc
  1339. }
  1340. }
  1341. "LF" ? {
  1342. PEERDIR+=library/cpp/lfalloc
  1343. }
  1344. "LF_YT" ? {
  1345. PEERDIR+=library/cpp/lfalloc/yt
  1346. }
  1347. "LF_DBG" ? {
  1348. PEERDIR+=library/cpp/lfalloc/dbg
  1349. }
  1350. "B" ? {
  1351. PEERDIR+=library/cpp/balloc
  1352. }
  1353. "BM" ? {
  1354. PEERDIR+=library/cpp/balloc_market
  1355. }
  1356. "C" ? {
  1357. PEERDIR+=library/cpp/malloc/calloc
  1358. }
  1359. "LOCKLESS" ? {
  1360. PEERDIR+=library/cpp/malloc/lockless
  1361. }
  1362. "YT" ? {
  1363. PEERDIR+=library/cpp/ytalloc/impl
  1364. }
  1365. }
  1366. }
  1367. when ($ALLOCATOR == "SYSTEM") {
  1368. PEERDIR+=library/cpp/malloc/system
  1369. }
  1370. when ($WERROR != "no") {
  1371. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  1372. C_WARNING_OPTS += $WERROR_FLAG
  1373. }
  1374. }
  1375. when ($ICC == "yes") {
  1376. PEERDIR+=contrib/libs/intel/core
  1377. }
  1378. when ($WITH_VALGRIND == "yes") {
  1379. PEERDIR+=contrib/libs/valgrind
  1380. # https://st.yandex-team.ru/DTCC-122
  1381. CFLAGS+=-fdebug-default-version=4
  1382. }
  1383. }
  1384. when ($EMBED_LINKER_MAP == "yes" || $EMBED_LINKER_CREF == "yes") {
  1385. LINK_ADDITIONAL_SECTIONS_COMMAND+= \
  1386. $OBJCOPY_TOOL $LINK_ADDITIONAL_SECTIONS $TARGET
  1387. }
  1388. _SO_EXT_FILTER=${ext=.so:PEERS} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/:PEERS}
  1389. when ($OS_WINDOWS == "yes") {
  1390. _SO_EXT_FILTER=${ext=.dll:PEERS} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/:PEERS}
  1391. }
  1392. elsewhen ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  1393. _SO_EXT_FILTER=${ext=.dylib:PEERS} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/:PEERS}
  1394. }
  1395. LINK_OR_COPY_SO_CMD=
  1396. RPATH_GLOBAL=
  1397. when ($SO_OUTPUTS == "yes") {
  1398. LINK_OR_COPY_SO_CMD=$FS_TOOLS link_or_copy_to_dir --no-check $_SO_EXT_FILTER ${BINDIR}
  1399. LDFLAGS+=$RPATH_GLOBAL
  1400. }
  1401. # tag:restricted tag:DLL
  1402. ### $usage: WITH_DYNAMIC_LIBS() # restricted
  1403. ###
  1404. ### Include dynamic libraries as extra PROGRAM/DLL outputs
  1405. macro WITH_DYNAMIC_LIBS() {
  1406. ENABLE(SO_OUTPUTS)
  1407. }
  1408. # tag:internal
  1409. ### $usage: REAL_LINK_EXE_IMPL(peers...) # internal
  1410. macro REAL_LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1411. .CMD=$REAL_LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1412. }
  1413. # tag:internal
  1414. ### $usage: REAL_LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1415. macro REAL_LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1416. .CMD=$REAL_LINK_EXEC_DYN_LIB_CMDLINE
  1417. }
  1418. # tag:internal
  1419. ### $usage: REAL_LINK_DYN_LIB_IMPL(peers...) # internal
  1420. macro REAL_LINK_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1421. .CMD=$REAL_LINK_DYN_LIB_CMDLINE && $LINK_OR_COPY_SO_CMD
  1422. }
  1423. # tag:internal
  1424. ### $usage: LINK_EXE_IMPL(peers...) # internal
  1425. macro LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1426. .CMD=$LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  1427. }
  1428. # tag:internal
  1429. ### $usage: LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  1430. macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  1431. .CMD=$LINK_EXEC_DYN_LIB_CMDLINE
  1432. }
  1433. # tag:internal
  1434. ### @usage: _LINK_UNIT # internal
  1435. ###
  1436. ### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
  1437. module _LINK_UNIT: _BASE_UNIT {
  1438. .EXTS=.o .obj .supp .tidyjson .ld
  1439. .CMD=LINK_EXE
  1440. .ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  1441. .NODE_TYPE=Program
  1442. .PEERDIR_POLICY=as_build_from
  1443. .FINAL_TARGET=yes
  1444. .DEFAULT_NAME_GENERATOR=DirName
  1445. .ARGS_PARSER=Base
  1446. DEFAULT(ALLOCATOR $DEFAULT_ALLOCATOR)
  1447. _USE_LINKER()
  1448. #link with libunwind manually
  1449. when ($DARWIN == "yes" && $NOPLATFORM != "yes") {
  1450. PEERDIR += contrib/libs/cxxsupp
  1451. }
  1452. when ($USE_LIBCXXRT == "yes") {
  1453. PEERDIR += contrib/libs/cxxsupp/libcxxrt
  1454. }
  1455. when ($USE_DYNAMIC_CUDA == "yes") {
  1456. LINK_DYN_LIB_FLAGS += --dynamic-cuda
  1457. LINK_SCRIPT_EXE_FLAGS += --dynamic-cuda
  1458. }
  1459. ENABLE(COMMON_LINK_SETTINGS)
  1460. CHECK_PROVIDES()
  1461. }
  1462. MODULE_TYPE=UNKNOWN
  1463. macro ADD_CLANG_TIDY() {
  1464. ADD_YTEST($MODULE_PREFIX$REALPRJNAME clang_tidy)
  1465. when ($TIDY_ENABLED == "yes") {
  1466. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json
  1467. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json
  1468. }
  1469. }
  1470. # tag:internal
  1471. ### @usage: _BASE_PROGRAM # internal
  1472. ###
  1473. ### The base of all programs. It adds dependencies to make final artefact complete and runnable.
  1474. module _BASE_PROGRAM: _LINK_UNIT {
  1475. .SYMLINK_POLICY=EXE
  1476. .ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE
  1477. .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1478. SET(MODULE_TYPE PROGRAM)
  1479. SET(MODULE_LANG CPP)
  1480. FORCE_COVERAGE_ENABLED=yes
  1481. when ($OS_IOS == "yes") {
  1482. EXTS+=.ios.interface
  1483. }
  1484. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  1485. MODULE_SUFFIX=.exe
  1486. }
  1487. when ($TIDY_ENABLED == "yes") {
  1488. MODULE_SUFFIX=.tidyjson
  1489. }
  1490. when ($MSVC != "yes" && $NOPLATFORM != "yes" && $WITH_VALGRIND != "yes" && $USE_ASMLIB != "no" && $MIC_ARCH != "yes" && $PIC != "yes" && $PIE != "yes") {
  1491. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes" && $MUSL != "yes" && $SANITIZER_DEFINED != "yes" && $USE_THINLTO != "yes") {
  1492. PEERDIR+=contrib/libs/glibcasm
  1493. }
  1494. otherwise {
  1495. PEERDIR+=contrib/libs/asmlib
  1496. }
  1497. }
  1498. when ($MUSL == "yes") {
  1499. when ($MUSL_LITE == "yes") {
  1500. PEERDIR += contrib/libs/musl
  1501. }
  1502. otherwise {
  1503. PEERDIR += contrib/libs/musl/full
  1504. }
  1505. }
  1506. DEFAULT(CPU_CHECK yes)
  1507. when ($USE_SSE4 != "yes" || $NOUTIL == "yes" || $ALLOCATOR == "FAKE") {
  1508. CPU_CHECK = no
  1509. }
  1510. when ($CPU_CHECK == "yes") {
  1511. PEERDIR += library/cpp/cpuid_check
  1512. }
  1513. when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
  1514. PEERDIR += library/cpp/execprofile/autostart
  1515. }
  1516. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  1517. PEERDIR += contrib/libs/cxxsupp/libsan
  1518. when ($CLANG) {
  1519. select ($TARGET_PLATFORM) {
  1520. "LINUX" ? {
  1521. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/static
  1522. }
  1523. "DARWIN" ? {
  1524. # Memory sanitizer is not supported for darwin platform.
  1525. # https://clang.llvm.org/docs/MemorySanitizer.html#supported-platforms
  1526. when ($SANITIZER_TYPE != "memory") {
  1527. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/dynamic
  1528. }
  1529. }
  1530. default ? {
  1531. FATAL_ERROR_MESSAGE+=Unsupported platform for sanitizer
  1532. }
  1533. }
  1534. }
  1535. }
  1536. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1537. PEERDIR+=library/cpp/testing/dump_clang_coverage
  1538. }
  1539. when ($IDE_MSVS == "yes") {
  1540. PEERDIR+=build/scripts/c_templates
  1541. }
  1542. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  1543. LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  1544. }
  1545. }
  1546. 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"}
  1547. CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  1548. && ${VCS_INFO_SEM} \
  1549. && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE \
  1550. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1551. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1552. && target_compile_options PRIVATE $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  1553. ### @usage: PROGRAM([progname])
  1554. ###
  1555. ### Regular program module.
  1556. ### If name is not specified it will be generated from the name of the containing project directory.
  1557. module PROGRAM: _BASE_PROGRAM {
  1558. .SEM=CPP_PROGRAM_SEM
  1559. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1560. ADD_CLANG_TIDY()
  1561. }
  1562. # tag:python-specific tag:deprecated tag:internal
  1563. module _PY2_PROGRAM: _BASE_PY_PROGRAM {
  1564. SET(MODULE_LANG PY2)
  1565. # Looks like we cannot avoid copy-paste util ymake supports multiple inheritance
  1566. # We need to attach coverage.extractor to every py_program target, except pytest targets
  1567. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  1568. }
  1569. # tag:python-specific tag:deprecated
  1570. ### @usage: PY2_PROGRAM([progname]) # deprecated
  1571. ###
  1572. ### Deprecated. Use PY3_PROGRAM instead.
  1573. ### Python 2.x binary program. Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  1574. ### If name is not specified it will be generated from the name of the containing project directory.
  1575. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  1576. ###
  1577. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1578. module PY2_PROGRAM: _PY2_PROGRAM {
  1579. .RESTRICTED=STYLE_PYTHON
  1580. when ($FAIL_PY2 == "yes") {
  1581. _OK=no
  1582. }
  1583. elsewhen ($OPENSOURCE != "yes") {
  1584. PEERDIR+=build/rules/py2_deprecation
  1585. }
  1586. ASSERT(_OK You are using deprecated Python2-only code (PY2_PROGRAM). Please consider rewriting to Python 3.)
  1587. }
  1588. # tag:python-specific
  1589. ### @usage: NO_EXTENDED_SOURCE_SEARCH()
  1590. ###
  1591. ### Prevent module using in extended python source search.
  1592. ### Use the macro if module contains python2-only files (or other python sources which shouldn't be imported by python3 interpreter)
  1593. ### which resides in the same directories with python 3 useful code. contrib/python/future is a example.
  1594. ### Anyway, preferred way is to move such files into separate dir and don't use this macro at all.
  1595. ###
  1596. ### Also see: https://docs.yandex-team.ru/ya-make/manual/python/vars#y_python_extended_source_search for details
  1597. macro NO_EXTENDED_SOURCE_SEARCH() {
  1598. SET(NO_EXTENDED_SOURCE_SEARCH yes)
  1599. }
  1600. # tag:python-specific
  1601. ### @usage: PY3_PROGRAM([progname])
  1602. ###
  1603. ### Python 3.x binary program. Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  1604. ### If name is not specified it will be generated from the name of the containing project directory.
  1605. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules.
  1606. ###
  1607. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  1608. multimodule PY3_PROGRAM {
  1609. module PY3_BIN: PY3_PROGRAM_BIN {
  1610. .PEERDIRSELF=PY3_BIN_LIB
  1611. .IGNORED=RESOURCE RESOURCE_FILES PEERDIR TASKLET_REG RUN_ANTLR4_PYTHON BUILDWITH_CYTHON_CPP _BUILDWITH_CYTHON_CPP_DEP _BUILDWITH_CYTHON_CPP_H BUILDWITH_CYTHON_C _BUILDWITH_CYTHON_C_DEP _BUILDWITH_CYTHON_C_H _BUILDWITH_CYTHON_C_API_H
  1612. # Notify pybuild to skip almost all PY_SRCS arguments except MAIN
  1613. ENABLE(PROCESS_PY_MAIN_ONLY)
  1614. _PY_PROGRAM()
  1615. NO_CLANG_TIDY()
  1616. }
  1617. module PY3_BIN_LIB: PY3_LIBRARY {
  1618. .IGNORED=RESTRICT_LICENSES
  1619. # Notify pybuild to skip all python main function definitions
  1620. ENABLE(IGNORE_PY_MAIN)
  1621. _REQUIRE_EXPLICIT_LICENSE()
  1622. NO_CLANG_TIDY()
  1623. }
  1624. }
  1625. ### @usage: EXPORTS_SCRIPT(exports_file)
  1626. ###
  1627. ### Specify exports script within PROGRAM, DLL and DLL-derived modules.
  1628. ### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
  1629. ### The other option use EXPORTS parameter of the DLL module itself.
  1630. ###
  1631. ### @see: [DLL](#module_DLL)
  1632. macro EXPORTS_SCRIPT(Arg) {
  1633. SET(EXPORTS_FILE $Arg)
  1634. }
  1635. ### @usage: NO_EXPORT_DYNAMIC_SYMBOLS()
  1636. ###
  1637. ### Disable exporting all non-hidden symbols as dynamic when linking a PROGRAM.
  1638. macro NO_EXPORT_DYNAMIC_SYMBOLS() {
  1639. ENABLE(NO_EXPORT_DYNAMIC_SYMBOLS)
  1640. }
  1641. ### @usage: EXPORT_ALL_DYNAMIC_SYMBOLS()
  1642. ###
  1643. ### Export all non-hidden symbols as dynamic when linking a PROGRAM.
  1644. macro EXPORT_ALL_DYNAMIC_SYMBOLS() {
  1645. # Dummy: default behaviour
  1646. ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS)
  1647. }
  1648. ### @usage: USE_DYNAMIC_CUDA()
  1649. ###
  1650. ### Enable linking of PROGRAM with dynamic CUDA. By default CUDA uses static linking
  1651. macro USE_DYNAMIC_CUDA() {
  1652. LDFLAGS(-Wl,-rpath,$ORIGIN)
  1653. ENABLE(USE_DYNAMIC_CUDA)
  1654. }
  1655. ### @usage: CUSTOM_LINK_STEP_SCRIPT(name)
  1656. ###
  1657. ### Specifies name of a script for custom link step. The scripts
  1658. ### should be placed in the build/scripts directory and are subject to
  1659. ### review by devtools@.
  1660. macro CUSTOM_LINK_STEP_SCRIPT(Name) {
  1661. SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name)
  1662. }
  1663. ### @usage: _BASE_UNITTEST # internal
  1664. ###
  1665. ### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery.
  1666. module _BASE_UNITTEST: _BASE_PROGRAM {
  1667. .FINAL_TARGET=no
  1668. .NODE_TYPE=Program
  1669. .ALLOWED=YT_SPEC
  1670. when ($UT_SKIP_EXCEPTIONS == "yes") {
  1671. C_DEFINES+=-DUT_SKIP_EXCEPTIONS
  1672. }
  1673. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1674. }
  1675. _TEST_SPLIT_FACTOR_SEM=1
  1676. _TEST_TIMEOUT_SEM=
  1677. _TEST_PARTITION_SEM=
  1678. UNITTEST_SEM=$CPP_PROGRAM_SEM \
  1679. && set_property TARGET $REALPRJNAME PROPERTY SPLIT_FACTOR $_TEST_SPLIT_FACTOR_SEM \
  1680. $_TEST_PARTITION_SEM \
  1681. && add_yunittest NAME $REALPRJNAME TEST_TARGET $REALPRJNAME TEST_ARG --print-before-suite --print-before-test --fork-tests --print-times --show-fails \
  1682. && set_yunittest_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1683. && add_ytest_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1684. $_TEST_TIMEOUT_SEM
  1685. # tag:test
  1686. ### @usage: UNITTEST([name])
  1687. ###
  1688. ### Unit test module based on library/cpp/testing/unittest.
  1689. ### It is recommended not to specify the name.
  1690. ###
  1691. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#opisanievya.make1
  1692. module UNITTEST: _BASE_UNITTEST {
  1693. .SEM=UNITTEST_SEM
  1694. .DEFAULT_NAME_GENERATOR=FullPath
  1695. .ARGS_PARSER=Base
  1696. PEERDIR(library/cpp/testing/unittest_main)
  1697. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1698. when ($TEST_FORK_MODE != "none") {
  1699. when ($TEST_SPLIT_FACTOR) {
  1700. _TEST_SPLIT_FACTOR_SEM=$TEST_SPLIT_FACTOR
  1701. }
  1702. otherwise {
  1703. _TEST_SPLIT_FACTOR_SEM=10
  1704. }
  1705. when ($TEST_PARTITION == "MODULO") {
  1706. _TEST_PARTITION_SEM=&& set_property TARGET $REALPRJNAME PROPERTY SPLIT_TYPE $TEST_PARTITION \
  1707. }
  1708. }
  1709. when ($TEST_TIMEOUT) {
  1710. _TEST_TIMEOUT_SEM=&& set_yunittest_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1711. }
  1712. }
  1713. # tag:yt-specific tag:test
  1714. ### @usage: YT_UNITTEST([name])
  1715. ###
  1716. ### YT Unit test module based on library/cpp/testing/unittest with NYT::Initialize hook
  1717. module YT_UNITTEST: _BASE_UNITTEST {
  1718. PEERDIR(library/cpp/testing/unittest_main mapreduce/yt/tests/yt_initialize_hook)
  1719. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1720. }
  1721. # tag:test
  1722. ### @usage: UNITTEST_WITH_CUSTOM_ENTRY_POINT([name])
  1723. ###
  1724. ### Generic unit test module.
  1725. module UNITTEST_WITH_CUSTOM_ENTRY_POINT: _BASE_UNITTEST {
  1726. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1727. }
  1728. GTEST_SEM=$CPP_PROGRAM_SEM \
  1729. && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
  1730. && set_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1731. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1732. $_TEST_TIMEOUT_SEM
  1733. # tag:cpp-specific tag:test
  1734. ### @usage: GTEST([name])
  1735. ###
  1736. ### Unit test module based on library/cpp/testing/gtest.
  1737. ### It is recommended not to specify the name.
  1738. ###
  1739. ### Documentation: https://docs.yandex-team.ru/arcadia-cpp/cpp_test
  1740. module GTEST: _BASE_UNITTEST {
  1741. .SEM=GTEST_SEM
  1742. .DEFAULT_NAME_GENERATOR=FullPath
  1743. .ARGS_PARSER=Base
  1744. PEERDIR(library/cpp/testing/gtest library/cpp/testing/gtest_main)
  1745. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gunittest)
  1746. when ($TEST_TIMEOUT) {
  1747. _TEST_TIMEOUT_SEM=&& set_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1748. }
  1749. }
  1750. USE_AFL=no
  1751. # tag:fuzzing
  1752. ### @usage: FUZZ()
  1753. ###
  1754. ### In order to start using Fuzzing in Arcadia, you need to create a FUZZ module with the implementation of the function LLVMFuzzerTestOneInput().
  1755. ### This module should be reachable by RECURSE from /autocheck project in order for the corpus to be regularly updated.
  1756. ### AFL and Libfuzzer are supported in Arcadia via a single interface, but the automatic fuzzing still works only through Libfuzzer.
  1757. ###
  1758. ### Example: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/re2/re2/fuzzing/re2_fuzzer.cc?rev=2919463#L58
  1759. ###
  1760. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1761. module FUZZ: _BASE_PROGRAM {
  1762. .NODE_TYPE=Program
  1763. .FINAL_TARGET=no
  1764. .ALLOWED=FUZZ_DICTS FUZZ_OPTS
  1765. SET(LIBFUZZER_PATH contrib/libs/libfuzzer)
  1766. when ($USE_AFL == "no") {
  1767. PEERDIR+=$LIBFUZZER_PATH
  1768. }
  1769. when ($USE_AFL == "yes") {
  1770. PEERDIR+=$LIBFUZZER_PATH/afl
  1771. }
  1772. when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
  1773. PEERDIR+=devtools/nofuzz
  1774. }
  1775. ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)
  1776. }
  1777. # tag:ios-specific
  1778. PACK_IOS_CMD=
  1779. when ($OS_IOS && $BUILD_IOS_APP) {
  1780. PACK_IOS_CMD=$YMAKE_PYTHON ${input:"build/scripts/pack_ios.py"} --binary $TARGET --target $TARGET --temp-dir $BINDIR $PEERS
  1781. }
  1782. LINK_BOOSTTEST_CMD=
  1783. BOOST_TEST_TYPE_STRING=
  1784. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1785. LINK_BOOSTTEST_CMD=$LINK_RECURSIVE_LIBRARY
  1786. BOOST_TEST_TYPE_STRING=no.test
  1787. }
  1788. otherwise {
  1789. LINK_BOOSTTEST_CMD=$LINK_EXE
  1790. BOOST_TEST_TYPE_STRING=boost.test
  1791. }
  1792. # tag:deprecated
  1793. ### @usage: BOOSTTEST([name]) #deprecated
  1794. ###
  1795. ### Test module based on boost/test/unit_test.hpp.
  1796. ### As with entire boost library usage of this technology is deprecated in Arcadia and restricted with configuration error in most of projects.
  1797. ### No new module of this type should be introduced unless it is explicitly approved by C++ committee.
  1798. module BOOSTTEST: _BASE_PROGRAM {
  1799. .NODE_TYPE=Program
  1800. .FINAL_TARGET=no
  1801. .CMD=LINK_BOOSTTEST_CMD
  1802. PEERDIR(library/cpp/testing/boost_test)
  1803. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1804. MODULE_SUFFIX=.a
  1805. }
  1806. elsewhen ($OS_IOS && $BUILD_IOS_APP) {
  1807. PEERDIR+=devtools/boosttest_ios_wrapper/library
  1808. MODULE_SUFFIX=.ios.tar
  1809. }
  1810. ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING)
  1811. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1812. }
  1813. # tag:deprecated
  1814. ### @usage BOOSTTEST_WITH_MAIN([name]) #deprecated
  1815. ###
  1816. ### Same as BOOSTTEST (see above), but comes with builtin int main(argc, argv) implementation
  1817. module BOOSTTEST_WITH_MAIN: BOOSTTEST {
  1818. PEERDIR(library/cpp/testing/boost_test_main)
  1819. }
  1820. FUZZ_DICTS_VALUE=
  1821. ### @usage: FUZZ_DICTS(path1 [path2...])
  1822. ###
  1823. ### Allows you to specify dictionaries, relative to the root of Arcadia, which will be used in Fuzzing.
  1824. ### Libfuzzer and AFL use a single syntax for dictionary descriptions.
  1825. ### Should only be used in FUZZ modules.
  1826. ###
  1827. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1828. macro FUZZ_DICTS(Data...) {
  1829. SET_APPEND(FUZZ_DICTS_VALUE $Data)
  1830. }
  1831. FUZZ_OPTS_VALUE=
  1832. ### @usage: FUZZ_OPTS(opt1 [Opt2...])
  1833. ###
  1834. ### Overrides or adds options to the corpus mining and fuzzer run.
  1835. ### Currently supported only Libfuzzer, so you should use the options for it.
  1836. ### Should only be used in FUZZ modules.
  1837. ###
  1838. ### @example:
  1839. ###
  1840. ### FUZZ_OPTS (
  1841. ### -max_len=1024
  1842. ### -rss_limit_mb=8192
  1843. ### )
  1844. ###
  1845. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1846. macro FUZZ_OPTS(Data...) {
  1847. SET_APPEND(FUZZ_OPTS_VALUE $Data)
  1848. }
  1849. # tag:yt-specific tag:test
  1850. TEST_YT_SPEC_VALUE=
  1851. ### @usage: YT_SPEC(path1 [path2...])
  1852. ###
  1853. ### Allows you to specify json-files with YT task and operation specs,
  1854. ### which will be used to run test node in the YT.
  1855. ### Test must be marked with ya:yt tag.
  1856. ### Files must be relative to the root of Arcadia.
  1857. ###
  1858. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1859. macro YT_SPEC(Data...) {
  1860. SET_APPEND(TEST_YT_SPEC_VALUE $Data)
  1861. }
  1862. # tag:test
  1863. TEST_SRCS_VALUE=
  1864. ### @usage: TEST_SRCS(Files...)
  1865. ###
  1866. ### 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.
  1867. ###
  1868. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  1869. macro TEST_SRCS(Tests...) {
  1870. SET_APPEND(TEST_SRCS_VALUE $Tests)
  1871. }
  1872. macro DISABLE_DATA_VALIDATION() {
  1873. DISABLE(VALIDATE_DATA)
  1874. }
  1875. # tag:test
  1876. TEST_DATA_VALUE=
  1877. ### @usage: DATA([path...])
  1878. ###
  1879. ### Specifies the path to the data necessary test.
  1880. ### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>.
  1881. ### In the latter case resource will be brought to the working directory of the test before it is started
  1882. ###
  1883. ### Used only inside TEST modules.
  1884. ###
  1885. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1886. macro DATA(Data...) {
  1887. SET_APPEND(TEST_DATA_VALUE $Data)
  1888. ADD_CHECK(check.data $Data)
  1889. }
  1890. # tag:test
  1891. ### @usage: DATA_FILES([path...])
  1892. ###
  1893. ### Specifies the path to the arcadia source data necessary test.
  1894. ### Used only inside TEST modules.
  1895. ###
  1896. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1897. macro DATA_FILES(Paths...) {
  1898. SET_APPEND(TEST_DATA_VALUE ${pre=arcadia/:Paths})
  1899. _DATA_FILES($Paths)
  1900. }
  1901. # tag:test
  1902. ### @usage: EXPLICIT_DATA()
  1903. ###
  1904. ### Disables implicit macro DATA(<module_path>).
  1905. ADD_SRCDIR_TO_TEST_DATA=yes
  1906. macro EXPLICIT_DATA() {
  1907. SET(ADD_SRCDIR_TO_TEST_DATA no)
  1908. }
  1909. # tag:test
  1910. TEST_TAGS_VALUE=
  1911. ### @usage: TAG ([tag...])
  1912. ###
  1913. ### Each test can have one or more tags used to filter tests list for running.
  1914. ### There are also special tags affecting test behaviour, for example ya:external, sb:ssd.
  1915. ###
  1916. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija
  1917. macro TAG(Tags...) {
  1918. SET_APPEND(TEST_TAGS_VALUE $Tags)
  1919. }
  1920. # tag:test
  1921. TEST_REQUIREMENTS_VALUE=
  1922. ### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64])
  1923. ###
  1924. ### Allows you to specify the requirements of the test.
  1925. ###
  1926. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1927. macro REQUIREMENTS(Tags...) {
  1928. SET_APPEND(TEST_REQUIREMENTS_VALUE $Tags)
  1929. }
  1930. # tag:test
  1931. TEST_ENV_VALUE=
  1932. ### @usage: ENV(key[=value])
  1933. ###
  1934. ### Sets env variable key to value (gets value from system env by default).
  1935. macro ENV(Data...) {
  1936. SET_APPEND(TEST_ENV_VALUE ${quo:Data})
  1937. }
  1938. ### @usage: CONFTEST_LOAD_POLICY_LOCAL()
  1939. ###
  1940. ### Loads conftest.py files in a way that pytest does it
  1941. macro CONFTEST_LOAD_POLICY_LOCAL() {
  1942. SET_APPEND(TEST_ENV_VALUE "CONFTEST_LOAD_POLICY=LOCAL")
  1943. }
  1944. # tag:test
  1945. TEST_RECIPES_VALUE=
  1946. ### @usage: USE_RECIPE(path [arg1 arg2...])
  1947. ###
  1948. ### Provides prepared environment via recipe for test.
  1949. ###
  1950. ### Documentation: https://wiki.yandex-team.ru/yatool/test/recipes
  1951. macro USE_RECIPE(Data...) {
  1952. SET_APPEND(TEST_RECIPES_VALUE $Data)
  1953. SET_APPEND(TEST_RECIPES_VALUE "USE_RECIPE_DELIM")
  1954. }
  1955. # tag:python-specific tag:test
  1956. TEST_PYTHON_PATH_VALUE=
  1957. # tag:python-specific tag:test
  1958. ### @usage: PYTHON_PATH(Path)
  1959. ###
  1960. ### Set path to Python that will be used to runs scripts in tests
  1961. macro PYTHON_PATH(Path) {
  1962. SET(TEST_PYTHON_PATH_VALUE $Path)
  1963. }
  1964. # tag:test
  1965. SKIP_TEST_VALUE=
  1966. ### @usage: SKIP_TEST(Reason)
  1967. ###
  1968. ### Skip the suite defined by test module. Provide a reason to be output in test execution report.
  1969. macro SKIP_TEST(Reason...) {
  1970. SET(SKIP_TEST_VALUE $Reason)
  1971. }
  1972. # tag:test
  1973. LINT_LEVEL_VALUE=extended
  1974. _NO_LINT_VALUE=
  1975. ### @usage: NO_LINT([ktlint])
  1976. ###
  1977. ### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS.
  1978. ### Ktlint can be disabled using NO_LINT(ktlint) explicitly.
  1979. macro NO_LINT(ktlint?"ktlint":"none") {
  1980. SET(_NO_LINT_VALUE ${ktlint})
  1981. }
  1982. ### @usage: LINT(<none|base|strict>)
  1983. ###
  1984. ### Set linting level for sources of the module
  1985. macro LINT(level) {
  1986. SET(LINT_LEVEL_VALUE $level)
  1987. }
  1988. # tag:python-specific tag:test
  1989. STYLE_PYTHON_VALUE=no
  1990. STYLE_PYTHON_PYPROJECT_VALUE=
  1991. ### @usage: STYLE_PYTHON([pyproject])
  1992. ###
  1993. ### Check python3 sources for style issues using black.
  1994. macro STYLE_PYTHON(pyproject...) {
  1995. SET(STYLE_PYTHON_VALUE yes)
  1996. SET(STYLE_PYTHON_PYPROJECT_VALUE ${pyproject})
  1997. }
  1998. # tag:python-specific tag:test
  1999. ### @usage: NO_DOCTESTS()
  2000. ###
  2001. ### Disable doctests in PY[|3|23_]TEST
  2002. macro NO_DOCTESTS() {
  2003. ENV(YA_PYTEST_DISABLE_DOCTEST="yes")
  2004. }
  2005. # tag:python-specific tag:test
  2006. ### @usage: _BASE_PYTEST # internal
  2007. ###
  2008. ### Base logic of Python 2.x py.test modules: common module properties and dependencies.
  2009. module _BASE_PYTEST: _BASE_PY_PROGRAM {
  2010. .NODE_TYPE=Program
  2011. .FINAL_TARGET=no
  2012. .ALLOWED=YT_SPEC NO_DOCTESTS
  2013. when ($USE_ARCADIA_PYTHON == "yes") {
  2014. PEERDIR+=library/python/pytest
  2015. }
  2016. when ($USE_ARCADIA_PYTHON == "no") {
  2017. MODULE_SUFFIX=.pkg.fake
  2018. PEERDIR+=library/python/pytest/empty
  2019. }
  2020. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2021. }
  2022. # tag:python-specific tag:deprecated tag:test
  2023. ### @usage: PYTEST_BIN() #deprecated
  2024. ###
  2025. ### Same as PY2TEST. Don't use this, use PY2TEST instead.
  2026. module PYTEST_BIN: _BASE_PYTEST {
  2027. .NODE_TYPE=Program
  2028. .DEFAULT_NAME_GENERATOR=FullPath
  2029. .ARGS_PARSER=Base
  2030. SETUP_PYTEST_BIN()
  2031. }
  2032. # tag:python-specific tag:test
  2033. ### @usage: PY2TEST([name])
  2034. ###
  2035. ### The test module for Python 2.x based on py.test
  2036. ###
  2037. ### This module is compatible only with PYTHON2-tagged modules and selects peers from multimodules accordingly.
  2038. ### This module is compatible with non-Arcadia Python builds.
  2039. ###
  2040. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#python
  2041. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2042. module PY2TEST: PYTEST_BIN {
  2043. .RESTRICTED=STYLE_PYTHON
  2044. .DEFAULT_NAME_GENERATOR=FullPath
  2045. .ARGS_PARSER=Base
  2046. when ($FAIL_PY2 == "yes") {
  2047. _OK=no
  2048. }
  2049. elsewhen ($OPENSOURCE != "yes") {
  2050. PEERDIR+=build/rules/py2_deprecation
  2051. }
  2052. SET(MODULE_LANG PY2)
  2053. ASSERT(_OK You are using deprecated Python2-only code (PY2TEST). Please consider rewriting to Python 3.)
  2054. }
  2055. # tag:python-specific tag:deprecated tag:test
  2056. ### @usage: PY3TEST_BIN() #deprecated
  2057. ###
  2058. ### Same as PY3TEST. Don't use this, use PY3TEST instead.
  2059. module PY3TEST_BIN: _BASE_PY3_PROGRAM {
  2060. .NODE_TYPE=Program
  2061. .FINAL_TARGET=no
  2062. .ALLOWED=YT_SPEC NO_DOCTESTS
  2063. .DEFAULT_NAME_GENERATOR=FullPath
  2064. .ARGS_PARSER=Base
  2065. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2066. SET(MODULE_LANG PY3)
  2067. SETUP_PYTEST_BIN()
  2068. PEERDIR+=library/python/pytest
  2069. }
  2070. # tag:python-specific tag:test
  2071. ### Disable submodules with the specified name(s).
  2072. ### Unlike EXCLUDE_TAGS this variable:
  2073. ### - affects all projects in the build;
  2074. ### - filter by module name and ignore MODULE_TAG.
  2075. EXCLUDE_SUBMODULES=PY3TEST_LIBRARY
  2076. # tag:python-specific tag:test
  2077. ### @usage: PY3TEST([name])
  2078. ###
  2079. ### The test module for Python 3.x based on py.test
  2080. ###
  2081. ### This module is compatible only with PYTHON3-tagged modules and selects peers from multimodules accordingly.
  2082. ### This module is only compatible with Arcadia Python build (to avoid tests duplication from Python2/3-tests). For non-Arcadia python use PYTEST.
  2083. ###
  2084. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  2085. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2086. multimodule PY3TEST {
  2087. module PY3TEST_PROGRAM: PY3TEST_BIN {
  2088. .IGNORED=RUN_ANTLR4_PYTHON
  2089. .FINAL_TARGET=yes
  2090. }
  2091. module PY3TEST_LIBRARY: PY3_LIBRARY {
  2092. PEERDIR+=library/python/pytest
  2093. _REQUIRE_EXPLICIT_LICENSE()
  2094. }
  2095. }
  2096. # tag:cpp-specific tag:test
  2097. module CPP_STYLE_TEST_14: PY3TEST_BIN {
  2098. DEPENDS(contrib/libs/clang14/tools/clang-format)
  2099. PEERDIR+=library/python/cpp_test
  2100. }
  2101. macro STYLE(Globs...) {
  2102. _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
  2103. _STYLE(${STYLE_SRCS_GLOB})
  2104. }
  2105. # tag:cpp-specific tag:deprecated tag:test
  2106. ### @usage: GTEST_UGLY([name])
  2107. ###
  2108. ### Deprecated, do not use in new projects. Use GTEST instead.
  2109. ###
  2110. ### The test module based on gtest (contrib/libs/gtest contrib/libs/gmock).
  2111. ### Use public documentation on gtest for details.
  2112. ###
  2113. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2114. module GTEST_UGLY: _BASE_PROGRAM {
  2115. .NODE_TYPE=Program
  2116. .FINAL_TARGET=no
  2117. PEERDIR(contrib/restricted/googletest/googlemock contrib/restricted/googletest/googletest)
  2118. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gtest)
  2119. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2120. }
  2121. # tag:test
  2122. ### @usage: EXECTEST()
  2123. ###
  2124. ### Module definition of generic test that executes a binary.
  2125. ### Use macro RUN to specify binary to run.
  2126. ###
  2127. ### @example:
  2128. ###
  2129. ### EXECTEST()
  2130. ### OWNER(g:yatool)
  2131. ###
  2132. ### RUN(
  2133. ### cat input.txt
  2134. ### )
  2135. ### DATA(
  2136. ### arcadia/devtools/ya/test/tests/exectest/data
  2137. ### )
  2138. ### DEPENDS(
  2139. ### devtools/dummy_arcadia/cat
  2140. ### )
  2141. ### TEST_CWD(devtools/ya/test/tests/exectest/data)
  2142. ### END()
  2143. ###
  2144. ### More examples: https://wiki.yandex-team.ru/yatool/test/#exec-testy
  2145. ###
  2146. ### @see: [RUN()](#macro_RUN)
  2147. module EXECTEST: _BARE_UNIT {
  2148. .NODE_TYPE=Program
  2149. .FINAL_TARGET=no
  2150. .ALLOWED=YT_SPEC
  2151. .RESTRICTED=FORK_TEST_FILES
  2152. .DEFAULT_NAME_GENERATOR=FullPath
  2153. .ARGS_PARSER=Base
  2154. SET(MODULE_SUFFIX .pkg.fake)
  2155. SETUP_EXECTEST()
  2156. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  2157. }
  2158. # tag:cpp-specific tag:test
  2159. ### @usage: Y_BENCHMARK([benchmarkname])
  2160. ###
  2161. ### Benchmark test based on the library/cpp/testing/benchmark.
  2162. ###
  2163. ### For more details see: https://wiki.yandex-team.ru/yatool/test/#zapuskbenchmark
  2164. module Y_BENCHMARK: PROGRAM {
  2165. .SEM=CPP_PROGRAM_SEM
  2166. PEERDIR(library/cpp/testing/benchmark/main)
  2167. }
  2168. GBENCH_SEM=$CPP_PROGRAM_SEM \
  2169. && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
  2170. && set_property TEST $REALPRJNAME PROPERTY LABELS SMALL $FILTER_ONLY_TEST_TAGS \
  2171. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  2172. $_TEST_TIMEOUT_SEM
  2173. # tag:cpp-specific tag:test
  2174. ### @usage: G_BENCHMARK([benchmarkname])
  2175. ###
  2176. ### Benchmark test based on the google benchmark.
  2177. ###
  2178. ### For more details see: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/benchmark/README.md
  2179. module G_BENCHMARK: _BASE_PROGRAM {
  2180. .SEM=GBENCH_SEM
  2181. PEERDIR(library/cpp/testing/gbenchmark)
  2182. ADD_YTEST($MODULE_PREFIX$REALPRJNAME g_benchmark)
  2183. }
  2184. # tag:test
  2185. TEST_ROOT=$(TESTS_DATA_ROOT)
  2186. RESULT_MAX_FILE=0
  2187. STRIP_FILES=--dont-strip-files
  2188. VERIFY_RESULTS=--verify-results
  2189. ADDITIONAL_PATH=
  2190. # set for tests variables to fill it by YA_DEV or YA
  2191. YA_ROOT=ya
  2192. when ($YA_DEV == "yes") {
  2193. YA_ROOT=ya-dev
  2194. }
  2195. # tag:test
  2196. ### @usage: UNITTEST_FOR(path/to/lib)
  2197. ###
  2198. ### Convenience extension of UNITTEST module.
  2199. ### The UNINTTEST module with additional SRCDIR + ADDINCL + PEERDIR on path/to/lib.
  2200. ### path/to/lib is the path to the directory with the LIBRARY project.
  2201. ###
  2202. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  2203. module UNITTEST_FOR: UNITTEST {
  2204. .SEM=UNITTEST_SEM
  2205. PEERDIR(ADDINCL $UNITTEST_DIR)
  2206. SRCDIR($UNITTEST_DIR)
  2207. }
  2208. ### @usage: _LIBRARY # internal
  2209. ###
  2210. ### Base module definition for all libraries.
  2211. ### Contains basic logic like module properties, default variable values etc.
  2212. ### All libraries similar to C++-libraries should be inherited from it.
  2213. module _LIBRARY: _BASE_UNIT {
  2214. .CMD=LINK_LIB
  2215. .NODE_TYPE=Library
  2216. .PEERDIR_POLICY=as_include
  2217. .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
  2218. .ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  2219. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2220. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
  2221. .FINAL_TARGET=no
  2222. .GLOBAL_CMD=GLOBAL_LINK_LIB
  2223. .GLOBAL_EXTS=.o .obj .tidyjson
  2224. GLOBAL_SUFFIX=.global$MODULE_SUFFIX
  2225. #TODO: Remove this hack (really we do not need add fake src at all)
  2226. ENABLE(NEED_ADD_FAKE_SRC)
  2227. _REQUIRE_EXPLICIT_LICENSE(contrib/deprecated contrib/libs contrib/restricted contrib/python)
  2228. CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python)
  2229. when ($USE_MKL == "yes") {
  2230. NOPLATFORM=yes
  2231. }
  2232. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2233. MODULE_PREFIX=
  2234. MODULE_SUFFIX=.lib
  2235. }
  2236. otherwise {
  2237. when ($TIDY_ENABLED == "yes") {
  2238. MODULE_PREFIX=
  2239. MODULE_SUFFIX=.tidyjson
  2240. }
  2241. otherwise {
  2242. MODULE_PREFIX=lib
  2243. MODULE_SUFFIX=.a
  2244. }
  2245. }
  2246. when ($WERROR != "no") {
  2247. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  2248. C_WARNING_OPTS += $WERROR_FLAG
  2249. }
  2250. }
  2251. when ($WITH_VALGRIND == "yes") {
  2252. PEERDIR+=contrib/libs/valgrind
  2253. # https://st.yandex-team.ru/DTCC-1227
  2254. CFLAGS+=-fdebug-default-version=4
  2255. }
  2256. when ($USE_ARCADIA_LIBM == "yes") {
  2257. PEERDIR+=contrib/libs/libm
  2258. }
  2259. }
  2260. CPP_LIBRARY_INDUCED_SEM_PROPERTY=consumer_link_library
  2261. CPP_LIBRARY_SEM=add_library ${MODDIR} $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  2262. && library_fake_marker FAKE_MODULE ${FAKE_MODULE} \
  2263. && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET \
  2264. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2265. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2266. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2267. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  2268. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW \
  2269. && add_language C && add_language CXX
  2270. CPP_OBJ_LIBRARY_SEM=add_global_library_for ${MODDIR} ${suf=.global:CMAKE_TARGET_NAME} $CMAKE_TARGET_NAME ${hide:GLOBAL_TARGET} ${hide:AUTO_INPUT} \
  2271. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2272. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2273. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2274. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  2275. CMAKE_FIND_PKG=
  2276. CMAKE_LINK_TARGET=$REALPRJNAME
  2277. CMAKE_FIND_PKG_COMP=
  2278. CONAN_REQUIRE=
  2279. CONAN_OPTS_SEM=
  2280. ### @usage: LIBRARY()
  2281. ###
  2282. ### The regular static library module.
  2283. ###
  2284. ### The LIBRARY() is intermediate module, so when built directly it won't build its dependencies.
  2285. ### It transitively provides its PEERDIRs to ultimate final target, where all LIBRARY() modules are built and linked together.
  2286. ###
  2287. ### This is C++ library, and it selects peers from multimodules accordingly.
  2288. ###
  2289. ### It makes little sense to mention LIBRARY in DEPENDS or BUNDLE, package and deploy it since it is not a standalone entity.
  2290. ### In order to use library in tests PEERDIR it to link into tests.
  2291. ### If you think you need to distribute static library please contact devtools@ for assistance.
  2292. module LIBRARY: _LIBRARY {
  2293. .GLOBAL=_AARS _PROGUARD_RULES
  2294. .SEM=CPP_LIBRARY_SEM
  2295. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  2296. .DEFAULT_NAME_GENERATOR=ThreeDirNames
  2297. .ARGS_PARSER=Base
  2298. when ($CMAKE_PACKAGE_COMPONENT != "") {
  2299. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  2300. }
  2301. when ($CMAKE_PACKAGE != "") {
  2302. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  2303. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2304. }
  2305. when ($CONAN_REFERENCE != "") {
  2306. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  2307. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2308. }
  2309. when ($CONAN_PKG_OPTS != "") {
  2310. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  2311. }
  2312. when ($OPENSOURCE_EXPORT == "no") {
  2313. CPP_LIBRARY_SEM=IGNORED
  2314. }
  2315. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no" && $SANITIZE_HEADERS && $SANITIZE_HEADERS != "no") {
  2316. PEERDIR += library/cpp/sanitizer/include
  2317. }
  2318. when ($HAS_CPP_PROTOBUF_PEERS == "yes") {
  2319. PEERDIR+=$CPP_PROTOBUF_PEERS
  2320. }
  2321. SET(MODULE_TYPE LIBRARY)
  2322. SET(MODULE_LANG CPP)
  2323. ADD_CLANG_TIDY()
  2324. }
  2325. # tag:internal
  2326. ### @usage: _BARE_MODULE() # internal
  2327. ###
  2328. ### Remove unwanted dependencies for "empty" library module
  2329. macro _BARE_MODULE() {
  2330. SET(NEED_PLATFORM_PEERDIRS no)
  2331. SET(PEERDIR_TEST_TOOL no)
  2332. DISABLE(WITH_VALGRIND)
  2333. NO_CODENAVIGATION()
  2334. NO_PLATFORM()
  2335. NO_RUNTIME()
  2336. NO_UTIL()
  2337. NO_CLANG_TIDY()
  2338. }
  2339. # tag:internal
  2340. ### @usage: _BARE_LINK_MODULE() # internal
  2341. ###
  2342. ### Remove unwanted dependencies for "empty" link module
  2343. macro _BARE_LINK_MODULE() {
  2344. _BARE_MODULE()
  2345. DISABLE(COMMON_LINK_SETTINGS)
  2346. ALLOCATOR(FAKE)
  2347. }
  2348. # tag:internal
  2349. ### @usage: _CONDITIONAL_SRCS([USE_CONDITIONAL_SRCS] Files...) # internal
  2350. ###
  2351. ### Adds Files... to SRCS if first word is `USE_CONDITIONAL_SRCS`
  2352. ### To be used with some variable which is set to `USE_CONDITIONAL_SRCS` under condition
  2353. macro _CONDITIONAL_SRCS(USE_CONDITIONAL_SRCS[], DYMMY...) {
  2354. SRCS($USE_CONDITIONAL_SRCS)
  2355. }
  2356. # XXX: dirty hack for correct LDFLAGS passing
  2357. RESOURCES_LIBRARY_LINK=$TOUCH_UNIT
  2358. RESOURCES_LIBRARY_SEM=IGNORED
  2359. ### @usage: RESOURCES_LIBRARY()
  2360. ###
  2361. ### Definition of a module that brings its content from external source (Sandbox) via DECLARE_EXTERNAL_RESOURCE macro.
  2362. ### This can participate in PEERDIRs of others as library but it cannot have own sources and PEERDIRs.
  2363. ###
  2364. ### @see: [DECLARE_EXTERNAL_RESOURCE()](#macro_DECLARE_EXTERNAL_RESOURCE)
  2365. module RESOURCES_LIBRARY: _BARE_UNIT {
  2366. .CMD=RESOURCES_LIBRARY_LINK
  2367. .SEM=RESOURCES_LIBRARY_SEM
  2368. .ALLOWED=DECLARE_EXTERNAL_RESOURCE EXTRALIBS OBJADDE_GLOBAL
  2369. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SRC SRCS PEERDIR SPLIT_DWARF
  2370. .NODE_TYPE=Library
  2371. .PEERDIR_POLICY=as_include
  2372. .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
  2373. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2374. when ($CMAKE_PACKAGE_COMPONENT != "") {
  2375. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  2376. }
  2377. when ($CMAKE_PACKAGE != "") {
  2378. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  2379. RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2380. }
  2381. when ($CONAN_REFERENCE != "") {
  2382. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  2383. RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  2384. }
  2385. when ($CONAN_PKG_OPTS != "") {
  2386. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  2387. }
  2388. MODULE_SUFFIX=.pkg.fake
  2389. ENABLE(NEED_ADD_FAKE_SRC)
  2390. WITHOUT_LICENSE_TEXTS()
  2391. }
  2392. FAT_OBJECT_SEM=add_fat_object ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  2393. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2394. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2395. && set_global_flags FAT_OBJECT_PREFIX ${MODULE_PREFIX} \
  2396. && set_global_flags FAT_OBJECT_SUFFIX ${MODULE_SUFFIX}
  2397. ### Do not turn visibility=hidden symbos into static symbos of partially linked object file
  2398. ###
  2399. ### Note: This variable do not have any effect on platforms other than MacOS and iOS.
  2400. KEEP_FAT_OBJECT_SYMBOLS=no
  2401. ### @usage: FAT_OBJECT()
  2402. ###
  2403. ### The "fat" object module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2404. ### static libraries, local (from own SRCS) and global (from peers') object files.
  2405. ###
  2406. ### Designed for use in XCode projects for iOS.
  2407. module FAT_OBJECT: LIBRARY {
  2408. .ALLOWED=PACK_GLOBALS_IN_LIBRARY
  2409. .CMD=LINK_FAT_OBJECT
  2410. .SEM=FAT_OBJECT_SEM
  2411. .PEERDIR_POLICY=as_build_from
  2412. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2413. MODULE_SUFFIX=.lib
  2414. }
  2415. otherwise {
  2416. MODULE_SUFFIX=.a
  2417. }
  2418. when (($OS_DARWIN == "yes" || $OS_IOS == "yes") && $KEEP_FAT_OBJECT_SYMBOLS == "yes") {
  2419. LDFLAGS_GLOBAL += -keep_private_externs
  2420. }
  2421. # FIXME: This is weird legacy
  2422. when ($OS_ANDROID == "yes") {
  2423. MODULE_PREFIX=lib
  2424. }
  2425. otherwise {
  2426. MODULE_PREFIX=
  2427. }
  2428. _USE_LINKER()
  2429. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2430. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2431. DISABLE(NEED_ADD_FAKE_SRC)
  2432. SRCS(build/scripts/_fake_src.cpp)
  2433. }
  2434. RECURSIVE_LIBRARY_SEM=add_recursive_library ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  2435. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  2436. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  2437. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  2438. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  2439. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW
  2440. ### @usage: RECURSIVE_LIBRARY()
  2441. ###
  2442. ### The recursive ("fat") library module. It will contain all its transitive dependencies reachable by PEERDIRs:
  2443. ### from static libraries, local (from own SRCS) and global (from peers') object files.
  2444. ###
  2445. ### Designed for use in XCode projects for iOS.
  2446. module RECURSIVE_LIBRARY: LIBRARY {
  2447. .CMD=LINK_RECURSIVE_LIBRARY
  2448. .SEM=RECURSIVE_LIBRARY_SEM
  2449. .PEERDIR_POLICY=as_build_from
  2450. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  2451. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  2452. DISABLE(NEED_ADD_FAKE_SRC)
  2453. SRCS(build/scripts/_fake_src.cpp)
  2454. }
  2455. _SONAME=
  2456. _EXPORT_SCRIPT_SEM=
  2457. _CLEAN_TEXTREL=
  2458. macro _ADD_DYNLYB_SEM(Libname) {
  2459. .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
  2460. }
  2461. CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($CMAKE_TARGET_NAME) $CMAKE_TARGET_ARTEFACT_RENAME_RULES
  2462. macro CLEAN_TEXTREL() {
  2463. SET(_CLEAN_TEXTREL yes)
  2464. }
  2465. ### @usage: DLL_UNIT # internal
  2466. ###
  2467. ### Base module for all dynamically linked libraries as final artifacts.
  2468. ### Contains all general logic for such kind of modules. Supports versioning and export files.
  2469. ### Cannot participate in linking to programs, intended to be used as final artifact (packaged and deployed).
  2470. module DLL_UNIT: _LINK_UNIT {
  2471. .CMD=LINK_DYN_LIB
  2472. .SEM=CPP_DYN_LIBRARY_SEM
  2473. .NODE_TYPE=Library
  2474. .SYMLINK_POLICY=SO
  2475. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  2476. .ALLOWED=WHOLE_ARCHIVE
  2477. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2478. .ARGS_PARSER=DLL
  2479. DYNAMIC_LINK=yes
  2480. ALLOCATOR(FAKE)
  2481. SET(MODULE_TYPE DLL)
  2482. SET(MODULE_TAG DLL)
  2483. SET(MODULE_LANG CPP)
  2484. ADD_CLANG_TIDY()
  2485. when ($EXPORTS_FILE) {
  2486. _EXPORT_SCRIPT_SEM=&& use_export_script ${input:EXPORTS_FILE}
  2487. }
  2488. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2489. MODULE_SUFFIX=.dll
  2490. }
  2491. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2492. MODULE_PREFIX=lib
  2493. MODULE_SUFFIX=.dylib
  2494. }
  2495. elsewhen ($TIDY_ENABLED == "yes") {
  2496. MODULE_PREFIX=
  2497. MODULE_SUFFIX=.tidyjson
  2498. }
  2499. otherwise {
  2500. MODULE_PREFIX=lib
  2501. MODULE_SUFFIX=.so
  2502. }
  2503. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2504. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2505. when ($MODULE_VERSION) {
  2506. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2507. }
  2508. _SONAME=$SONAME$MODULE_VERSION
  2509. when ($LINUX == "yes") {
  2510. # '-z notext' is needed for linking mkl into shared libraries
  2511. when ($_CLEAN_TEXTREL != "yes") {
  2512. LDFLAGS += -Wl,-z,notext
  2513. }
  2514. }
  2515. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes") {
  2516. when ($_NO_FIX_ELF != "yes") {
  2517. LINK_DYN_LIB_FLAGS+=--fix-elf ${tool:"tools/fix_elf"}
  2518. }
  2519. }
  2520. when ($DARWIN == "yes") {
  2521. LDFLAGS += -undefined dynamic_lookup
  2522. }
  2523. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  2524. PEERDIR+=library/cpp/testing/dump_clang_coverage
  2525. }
  2526. when ($IDE_MSVS == "yes") {
  2527. PEERDIR+=build/scripts/c_templates
  2528. }
  2529. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  2530. LINK_DYN_LIB_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  2531. }
  2532. }
  2533. # tag:python-specific
  2534. ### @usage: PY_ANY_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2535. ###
  2536. ### The Python external module for any versio of Arcadia or system Python.
  2537. ### 1. major_ver and minor_ver must be integers.
  2538. ### 2. The resulting .so will have the prefix "lib".
  2539. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2540. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2541. ###
  2542. ### Note: Use PYTHON2_MODULE()/PYTHON3_MODULE() in order to PEERDIR proper version of PY23_NATIVE_LIBRARY.
  2543. ### Do not PEERDIR any PY*_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2544. ###
  2545. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2546. module PY_ANY_MODULE: DLL_UNIT {
  2547. .SEM=CPP_DYN_LIBRARY_SEM
  2548. when ($MSVC != "yes" && $DARWIN != "yes") {
  2549. LDFLAGS+= -Wl,-Bsymbolic
  2550. }
  2551. when ($USE_ARCADIA_PYTHON == "no") {
  2552. when ($USE_SYSTEM_PYTHON) {
  2553. PEERDIR+=build/platform/python
  2554. }
  2555. otherwise {
  2556. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2557. LDFLAGS+=$PYTHON_LIBRARIES
  2558. }
  2559. }
  2560. }
  2561. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  2562. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  2563. when ($MODULE_VERSION) {
  2564. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  2565. }
  2566. _SONAME=$SONAME$MODULE_VERSION
  2567. # -bundle
  2568. when ($DARWIN == "yes") {
  2569. LDFLAGS+=-flat_namespace
  2570. }
  2571. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2572. MODULE_PREFIX=
  2573. MODULE_SUFFIX=.pyd
  2574. }
  2575. otherwise {
  2576. MODULE_PREFIX=
  2577. MODULE_SUFFIX=.so
  2578. }
  2579. .RESTRICTED=USE_PYTHON2 USE_PYTHON3 PY_SRCS PY_MAIN
  2580. }
  2581. # tag:python-specific
  2582. ### @usage: PY2MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2583. ###
  2584. ### The Python external module for Python2 and any system Python
  2585. ### 1. major_ver and minor_ver must be integers.
  2586. ### 2. The resulting .so will have the prefix "lib".
  2587. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2588. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2589. ###
  2590. ### Note: this module will always PEERDIR Python2 version of PY23_NATIVE_LIBRARY.
  2591. ### Do not PEERDIR PY2_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2592. ###
  2593. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2594. module PY2MODULE: PY_ANY_MODULE {
  2595. PYTHON2_MODULE()
  2596. SET(MODULE_LANG PY2)
  2597. .RESTRICTED=PYTHON3_MODULE PYTHON3_ADDINCL
  2598. }
  2599. # tag:python-specific
  2600. ### @usage: PY3MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2601. ###
  2602. ### The Python external module for Python3 and any system Python
  2603. ### 1. major_ver and minor_ver must be integers.
  2604. ### 2. The resulting .so will have the prefix "lib".
  2605. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2606. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2607. ###
  2608. ### Note: this module will always PEERDIR Python3 version of PY23_NATIVE_LIBRARY.
  2609. ### Do not PEERDIR PY3_LIBRARY or PY23_LIBRARY: this will link Python in and render artifact unusable as Python module.
  2610. ###
  2611. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  2612. module PY3MODULE: PY_ANY_MODULE {
  2613. PYTHON3_MODULE()
  2614. SET(MODULE_LANG PY3)
  2615. .RESTRICTED=PYTHON2_MODULE PYTHON2_ADDINCL
  2616. }
  2617. # tag:python-specific
  2618. ### @usage: PYTHON2_MODULE()
  2619. ###
  2620. ### Use in PY_ANY_MODULE to set it up for Python 2.x.
  2621. macro PYTHON2_MODULE() {
  2622. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2623. PEERDIR+=contrib/tools/python/lib
  2624. }
  2625. SET(ANTLR_PYTHON Python2)
  2626. PYTHON2_ADDINCL()
  2627. }
  2628. # tag:python-specific
  2629. ### @usage: PYTHON3_MODULE()
  2630. ###
  2631. ### Use in PY_ANY_MODULE to set it up for Python 3.x.
  2632. macro PYTHON3_MODULE() {
  2633. when ($USE_ARCADIA_PYTHON == "yes" && $MSVC == "yes" || $IS_CROSS_TOOLS == "yes") {
  2634. PEERDIR+=contrib/tools/python3/lib
  2635. }
  2636. SET(ANTLR_PYTHON Python3)
  2637. PYTHON3_ADDINCL()
  2638. }
  2639. # tag:r-specific
  2640. ### @usage: R_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2641. ###
  2642. ### The external module for R language.
  2643. ### 1. major_ver and minor_ver must be integers.
  2644. ### 2. The resulting .so will have the prefix "lib".
  2645. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  2646. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  2647. module R_MODULE: DLL_UNIT {
  2648. .SEM=CPP_DYN_LIBRARY_SEM
  2649. when ($DARWIN == "yes") {
  2650. LDFLAGS+=-flat_namespace -dynamiclib
  2651. }
  2652. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2653. MODULE_PREFIX=lib
  2654. MODULE_SUFFIX=.dll
  2655. }
  2656. ADDINCL(contrib/libs/r-lang)
  2657. }
  2658. ### @usage: DYNAMIC_LIBRARY_FROM(Paths)
  2659. ###
  2660. ### Use specified libraries as sources of DLL
  2661. macro DYNAMIC_LIBRARY_FROM(Path...) {
  2662. PEERDIR($Path)
  2663. WHOLE_ARCHIVE($Path)
  2664. }
  2665. ### @usage: DLL(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2666. ###
  2667. ### Dynamic library module definition.
  2668. ### 1. major_ver and minor_ver must be integers.
  2669. ### 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
  2670. ### 3. PREFIX allows you to change the prefix of the output file (default DLL has the prefix "lib").
  2671. ###
  2672. ### DLL cannot participate in linking to programs but can be used from Java or as final artifact (packaged and deployed).
  2673. module DLL: DLL_UNIT {
  2674. .SEM=CPP_DYN_LIBRARY_SEM
  2675. SET(MAKE_ONLY_SHARED_LIB yes)
  2676. when ($OS_WINDOWS) {
  2677. MODULE_SUFFIX=.dll
  2678. }
  2679. # TODO: Make it possible to use this syntax
  2680. # DEFAULT(DLL_FOR_DIR no)
  2681. ### FIXME: XXX
  2682. ###when ($DLL_FOR_DIR != "no") {
  2683. ### SRCDIR($DLL_FOR_DIR)
  2684. ### ADDINCL($DLL_FOR_DIR)
  2685. ###}
  2686. }
  2687. ### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool.
  2688. module DLL_TOOL: DLL {
  2689. .SEM=CPP_DYN_LIBRARY_SEM
  2690. # ymake resolves only program nodes as tools.
  2691. .NODE_TYPE=Program
  2692. }
  2693. ### @usage: SO_PROGRAM(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  2694. ###
  2695. ### Executable dynamic library module definition.
  2696. ### 1. major_ver and minor_ver must be integers.
  2697. ### 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
  2698. ### 3. PREFIX allows you to change the prefix of the output file.
  2699. module SO_PROGRAM: DLL {
  2700. .CMD=LINK_EXEC_DYN_LIB
  2701. SET(MODULE_TYPE PROGRAM)
  2702. MODULE_PREFIX=
  2703. when ($MSVC == "yes" || $CYGWIN == "yes") {
  2704. MODULE_SUFFIX=.exe
  2705. }
  2706. otherwise {
  2707. MODULE_SUFFIX=
  2708. }
  2709. }
  2710. DLL_PROXY_CMD_MF=$GENERATE_MF && $COPY_CMD $AUTO_INPUT $TARGET
  2711. # tag:internal
  2712. ### @usage: DEV_DLL_PROXY() # internal
  2713. ###
  2714. ### The use of this module is strictly prohibited!!!
  2715. ### This is a temporary and project-specific solution.
  2716. module DEV_DLL_PROXY: _BARE_UNIT {
  2717. .NODE_TYPE=Library
  2718. .EXTS=.so .dll .dylib .mf
  2719. .CMD=DLL_PROXY_CMD_MF
  2720. DYNAMIC_LINK=yes
  2721. when ($OS_WINDOWS == "yes") {
  2722. MODULE_SUFFIX=.dll
  2723. }
  2724. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  2725. MODULE_PREFIX=lib
  2726. MODULE_SUFFIX=.dylib$MODULE_VERSION
  2727. }
  2728. otherwise {
  2729. MODULE_PREFIX=lib
  2730. MODULE_SUFFIX=.so$MODULE_VERSION
  2731. }
  2732. }
  2733. # tag:internal
  2734. ### @usage: DLL_PROXY() # internal
  2735. ###
  2736. ### The use of this module is strictly prohibited!!!
  2737. ### This is a temporary and project-specific solution.
  2738. module DLL_PROXY: DEV_DLL_PROXY {
  2739. .EXTS=.so .dylib .lib .mf
  2740. .PROXY=yes
  2741. .PEERDIR_POLICY=as_build_from
  2742. SET(PEERDIR_TAGS DLL __EMPTY__)
  2743. when ($OS_WINDOWS == "yes") {
  2744. MODULE_SUFFIX=.lib
  2745. }
  2746. }
  2747. # tag:internal
  2748. ### @usage: DYNAMIC_DEPS(Path...) # internal, temporary
  2749. ###
  2750. ### Enlist paths to all DYNAMIC_LIBRARY dependencies of the DYNAMIC_LIBRARY
  2751. ### This it needed to transfer their outputs through the library to PROGRAM
  2752. ### or dependent DLL/DYNAMIC_LIBRARY.
  2753. ###
  2754. ### Note: this is temporary solution until support of `super-global` variables come
  2755. ### which will enable transfer of some properties though final targets like DLLs.
  2756. macro DYNAMIC_DEPS(Path...) {
  2757. # PEERDIR as macro completely ignored in place where this macro applies
  2758. SET_APPEND(PEERDIR $Path)
  2759. }
  2760. # tag:internal
  2761. ### @usage: DYNAMIC_LIBRARY() # internal
  2762. ###
  2763. ### The use of this module is strictly prohibited except LGPL-related opensourcing
  2764. ### This provides linkable DLL module which brings its results to programs and tests
  2765. ### for seamless testing and packaging
  2766. multimodule DYNAMIC_LIBRARY {
  2767. module DLL_BIN: DLL {
  2768. .PROXY=yes
  2769. .IGNORED=PROVIDES
  2770. SET(MODULE_TAG DLL)
  2771. }
  2772. module DLL_LIB: _DLL_COMPATIBLE_LIBRARY {
  2773. .CMD=TOUCH_UNIT_MF
  2774. .PEERDIRSELF=DLL_BIN
  2775. .IGNORED=SRCS PEERDIR RUN_PROGRAM PYTHON DYNAMIC_LIBRARY_FROM GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2 USE_PYTHON3
  2776. .ALLOWED=DYNAMIC_DEPS
  2777. SET(PEERDIR_TAGS DLL_LIB __EMPTY__)
  2778. _BARE_MODULE()
  2779. DYNAMIC_LINK=yes
  2780. MODULE_SUFFIX=.pkg.fake
  2781. PEERDIR+=build/platform/local_so
  2782. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no" && $SANITIZE_HEADERS && $SANITIZE_HEADERS != "no") {
  2783. PEERDIR += library/cpp/sanitizer/include
  2784. }
  2785. # disable credits generation for static library
  2786. SET(CREDITS_FLAGS)
  2787. }
  2788. }
  2789. ### @usage: GLOBAL_SRCS(filenames...)
  2790. ###
  2791. ### Make all source files listed as GLOBAL.
  2792. ### Call to GLOBAL_SRCS macro is equivalent to call to SRCS macro when each source file is marked with GLOBAL keyword.
  2793. ### Arcadia root relative or project dir relative paths are supported for filenames arguments. GLOBAL keyword is not
  2794. ### recognized for GLOBAL_SRCS in contrast to SRCS macro.
  2795. ###
  2796. ### @example:
  2797. ### Consider the file to ya.make:
  2798. ###
  2799. ### LIBRARY()
  2800. ### GLOBAL_SRCS(foo.cpp bar.cpp)
  2801. ### END()
  2802. ###
  2803. ### @see: [SRCS()](#macro_SRCS)
  2804. macro GLOBAL_SRCS(Files...) {
  2805. SRCS(${pre=GLOBAL :Files})
  2806. }
  2807. ### @usage: ALL_SRCS([GLOBAL] filenames...)
  2808. ###
  2809. ### Make all source files listed as GLOBAL or not depending on the keyword GLOBAL
  2810. ### Call to ALL_SRCS macro is equivalent to call to GLOBAL_SRCS macro when GLOBAL keyword is specified
  2811. ### as the first argument and is equivalent to call to SRCS macro otherwise.
  2812. ###
  2813. ### @example:
  2814. ###
  2815. ### LIBRARY()
  2816. ### SET(MAKE_IT_GLOBAL GLOBAL)
  2817. ### ALL_SRCS(${MAKE_IT_GLOBAL} foo.cpp bar.cpp)
  2818. ### END()
  2819. ###
  2820. ### @see: [GLOBAL_SRCS()](#macro_GLOBAL_SRCS), [SRCS()](#macro_SRCS)
  2821. macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
  2822. SRCS(${pre=$GLOBAL :Files})
  2823. }
  2824. ### @usage: _DLL_COMPATIBLE_LIBRARY # internal
  2825. ###
  2826. ### Base module to place DLLs into multimodules back to back with libraries.
  2827. ### In order to function properly all modules in multimodule shall have the
  2828. ### same set of arguments. So this module is just library that accepts but
  2829. ### ignores all DLL arguments.
  2830. module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
  2831. .DEFAULT_NAME_GENERATOR=TwoDirNames
  2832. .ARGS_PARSER=DLL
  2833. }
  2834. @import "${CONF_ROOT}/conf/project_specific/yql_udf.conf"
  2835. # as SRCS in packages use macro BUNDLE_SRCS!
  2836. PACKED_PACKAGE_ARGS=
  2837. PACKED_PACKAGE_EXT=
  2838. ### @usage: PACK(archive_type)
  2839. ###
  2840. ### 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`
  2841. ###
  2842. ### Is not allowed other module types than PACKAGE().
  2843. ###
  2844. ### @see: [PACKAGE()](#module_PACKAGE)
  2845. macro PACK(Ext) {
  2846. SET(PACKED_PACKAGE_EXT $Ext)
  2847. }
  2848. PACKAGE_STRICT_VALUE=
  2849. macro PACKAGE_STRICT() {
  2850. SET(PACKAGE_STRICT_VALUE yes)
  2851. }
  2852. ### @usage: PACKAGE(name)
  2853. ###
  2854. ### Module collects what is described directly inside it, builds and collects all its transitively available PEERDIRs.
  2855. ### 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.
  2856. ### The data can be optionally packed if macro PACK() is used.
  2857. ###
  2858. ### Is only used together with the macros FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a PACKAGE.
  2859. ###
  2860. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2861. ###
  2862. ### @see: [PACK()](#macro_PACK)
  2863. multimodule PACKAGE {
  2864. module PACKAGE_FINAL: _BASE_UNIT {
  2865. .CMD=TOUCH_PACKAGE_MF
  2866. .ALIASES=SRCS=FILES
  2867. .ALLOWED=PACK
  2868. .PEERDIRSELF=PACKAGE_UNION
  2869. .USE_PEERS_LATE_OUTS=yes
  2870. .PEERDIR_POLICY=as_build_from
  2871. .FINAL_TARGET=yes
  2872. 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)
  2873. SET(MODULE_SUFFIX .final.pkg.fake)
  2874. SET(DONT_RESOLVE_INCLUDES yes)
  2875. NO_PLATFORM()
  2876. when ($PACKED_PACKAGE_EXT) {
  2877. PACKED_PACKAGE_ARGS+=--dest-arch ${output;pre=$MODULE_PREFIX;suf=.$PACKED_PACKAGE_EXT:REALPRJNAME}
  2878. }
  2879. SET(NEED_PLATFORM_PEERDIRS no)
  2880. }
  2881. module PACKAGE_UNION: UNION {
  2882. .CMD=UNION_CMD
  2883. .FINAL_TARGET=no
  2884. .ALLOWED=PACK
  2885. .IGNORED=VCS_INFO_FILE
  2886. SET(MODULE_SUFFIX .pkg.fake)
  2887. 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)
  2888. DISABLE(START_TARGET)
  2889. }
  2890. }
  2891. TOUCH_GROUP=$TOUCH_PACKAGE ${kv;hide:"p CI"}
  2892. ### @usage: CI_GROUP()
  2893. ###
  2894. ### Module collects what is described directly inside it transitively by PEERDIRs.
  2895. ### No particular layout of built artifacts is implied. This module is needed primarily for CI dependency analysis and may not trigger builds at all.
  2896. ###
  2897. ### Is only used together with the macro PEERDIR() and FILES(). Don't use SRCS inside CI_GROUP().
  2898. module CI_GROUP: _BARE_UNIT {
  2899. .CMD=TOUCH_GROUP
  2900. .PEERDIR_POLICY=as_build_from
  2901. .FINAL_TARGET=yes
  2902. .RESTRICTED=SRCS
  2903. .USE_PEERS_LATE_OUTS=yes
  2904. MODULE_SUFFIX=.ci.pkg.fake
  2905. PEERDIR_TAGS=CPP_PROTO PY3 PY3_NATIVE PY3_BIN PY3TEST_PROGRAM YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE DLL
  2906. }
  2907. # tag:generic tag:internal
  2908. TOUCH_UNIT_MF=$TOUCH_UNIT && $GENERATE_MF
  2909. # tag:proto
  2910. ### @usage: RESOLVE_PROTO()
  2911. ###
  2912. ### Enable include resolving within UNIONs and let system .proto being resolved
  2913. ### among .proto/.gztproto imports
  2914. ###
  2915. ### Note: it is currently impossible to enable resolving only for .proto, so resolving is enabled for all supported files
  2916. ### also we only add ADDINCL for stock protobuf. So use this macro with care: it may cause resolving problems those are
  2917. ### to be addressed by either ADDINCLs or marking them as TEXT. Please contact devtools for details.
  2918. macro RESOLVE_PROTO() {
  2919. SET(DONT_RESOLVE_INCLUDES no)
  2920. ADDINCL(FOR proto $PROTOBUF_PATH)
  2921. }
  2922. ### @usage: UNION(name)
  2923. ###
  2924. ### Collection of PEERDIR dependencies, files and artifacts.
  2925. ### UNION doesn't build its peers, just provides those to modules depending on it.
  2926. ### 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).
  2927. ###
  2928. ### Is only used together with the macros like FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a UNION.
  2929. ###
  2930. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2931. module UNION: _BASE_UNIT {
  2932. .CMD=UNION_CMD_MF
  2933. .FINAL_TARGET=no
  2934. .ALIASES=SRCS=FILES
  2935. .ALLOWED=EXPLICIT_OUTPUTS
  2936. .IGNORED=VCS_INFO_FILE
  2937. NO_PLATFORM()
  2938. SET(MODULE_SUFFIX .pkg.fake)
  2939. SET(DONT_RESOLVE_INCLUDES yes)
  2940. SET(NEED_PLATFORM_PEERDIRS no)
  2941. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN DLL PACKAGE_UNION
  2942. UNION_OUTS=${hide;late_out:AUTO_INPUT}
  2943. when ($_UNION_EXPLICIT_OUTPUTS) {
  2944. UNION_OUTS=$_EXPAND_INS_OUTS($_UNION_EXPLICIT_OUTPUTS)
  2945. }
  2946. }
  2947. # tag:python-specific
  2948. module _PY_PACKAGE: UNION {
  2949. .EXTS=.py
  2950. .ALLOWED=GRPC USE_SKIFF
  2951. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  2952. ENABLE(PY_PROTOS_FOR)
  2953. SET(PEERDIR_TAGS PY_PROTO)
  2954. SET(DONT_RESOLVE_INCLUDES no)
  2955. }
  2956. # tag:python-specific tag:deprecated tag:internal
  2957. ### @usage: PY_PACKAGE(name) # internal, deprecated
  2958. ###
  2959. ### This is module created via PY_PROTOS_FOR() macro
  2960. module PY_PACKAGE: _PY_PACKAGE {
  2961. .ALIASES=SRCS=SRCS
  2962. .FINAL_TARGET=yes
  2963. }
  2964. # tag:internal
  2965. ### @usage: _SET_FIRST_VALUE(name args...) # internal
  2966. ###
  2967. ### This macro sets the value of `name` variable to the value of next argument
  2968. macro _SET_FIRST_VALUE(NAME, VALUE, OTHER...) {
  2969. SET($NAME $VALUE)
  2970. }
  2971. # tag:python-specific
  2972. PY_NAMESPACE_VALUE=
  2973. # tag:python-specific
  2974. ### @usage: PY_NAMESPACE(prefix)
  2975. ###
  2976. ### Sets default Python namespace for all python sources in the module.
  2977. ### Especially suitable in PROTO_LIBRARY where Python sources are generated and there is no PY_SRCS to place NAMESPACE parameter.
  2978. macro PY_NAMESPACE(Arg) {
  2979. SET(PY_NAMESPACE_VALUE $Arg)
  2980. }
  2981. # tag:internal
  2982. ### @usage: _SRCS_NO_GLOBAL(files...) # internal
  2983. ###
  2984. ### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
  2985. ### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
  2986. ### Note: this macro changes order of source files.
  2987. macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
  2988. SRCS($GLOBAL $FILES)
  2989. }
  2990. @import "${CONF_ROOT}/conf/java.conf"
  2991. # tag:python-specific tag:deprecated
  2992. ### @usage: PY2_LIBRARY() # deprecated
  2993. ###
  2994. ### Deprecated. Use PY23_LIBRARY or PY3_LIBRARY instead.
  2995. ### Python 2.x binary built library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM.
  2996. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  2997. ### This module is only compatible with PYTHON2-tagged modules and selects those from multimodules.
  2998. ### This module is only compatible with Arcadia Python build.
  2999. ###
  3000. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3001. module PY2_LIBRARY: _LIBRARY {
  3002. _ARCADIA_PYTHON_ADDINCL()
  3003. when ($NO_PYTHON_INCLS != "yes") {
  3004. PEERDIR+=contrib/libs/python
  3005. }
  3006. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3007. MODULE_PREFIX=py
  3008. }
  3009. otherwise {
  3010. MODULE_PREFIX=libpy
  3011. }
  3012. .ALLOWED=FORK_TESTS
  3013. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3014. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS STYLE_PYTHON
  3015. USE_GLOBAL_CMD=yes
  3016. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3017. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3018. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3019. PY_PROTO_MYPY_PLUGIN_INTERNAL=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=__int___pb2.pyi:File} ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___pb2.pyi:File} ${nopath;noext;suf=_pb2.pyi:File}"})
  3020. }
  3021. SET(MODULE_LANG PY2)
  3022. ADD_CLANG_TIDY()
  3023. }
  3024. # tag:python-specific
  3025. ### @usage: PY3_LIBRARY()
  3026. ###
  3027. ### Python 3.x binary library. Builds sources from PY_SRCS to data suitable for PY2_PROGRAM
  3028. ### Adds dependencies to Python 2.x runtime library from Arcadia.
  3029. ### This module is only compatible with PYTHON3-tagged modules and selects those from multimodules.
  3030. ### This module is only compatible with Arcadia Python build.
  3031. ###
  3032. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3033. module PY3_LIBRARY: _LIBRARY {
  3034. _ARCADIA_PYTHON3_ADDINCL()
  3035. when ($NO_PYTHON_INCLS != "yes") {
  3036. PEERDIR+=contrib/libs/python
  3037. }
  3038. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3039. MODULE_PREFIX=py
  3040. }
  3041. otherwise {
  3042. MODULE_PREFIX=libpy
  3043. }
  3044. .ALLOWED=FORK_TESTS
  3045. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3046. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2 OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3047. USE_GLOBAL_CMD=yes
  3048. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3049. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3050. PYTHON_TYPE_FOR_CYTHON=PY3
  3051. ANTLR_PYTHON=Python3
  3052. when ($PY_PROTO_MYPY_ENABLED == "yes") {
  3053. PY_PROTO_MYPY_SUFFIX=_pb2.pyi
  3054. PY_PROTO_MYPY_PLUGIN=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=_pb2.pyi:File}
  3055. PY_PROTO_MYPY_PLUGIN_INTERNAL=$PY_PROTO_MYPY_PLUGIN_BASE ${output;hide;noauto;norel;nopath;noext;suf=__int___pb2.pyi:File} ${hide;kv:"ext_out_name_for_${nopath;noext;suf=__int___pb2.pyi:File} ${nopath;noext;suf=_pb2.pyi:File}"})
  3056. }
  3057. SET(MODULE_LANG PY3)
  3058. ADD_CLANG_TIDY()
  3059. }
  3060. # tag:python-specific
  3061. ### @usage: _BASE_PY_PROGRAM #internal
  3062. ###
  3063. ### The base module for all Python 2.x binary programs. Adds linking logic, relevant module properties and
  3064. ### dependency on Python 2.x interpreter. Also adds import tests on all sources including PEERDIR'ed libraries.
  3065. ### Links all Python 2.x libraries and Python 2.x interpreter into itself to form regular executable.
  3066. ### This only compatible with PYTHON2-tagged modules and selects those from multimodules.
  3067. ###
  3068. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3069. module _BASE_PY_PROGRAM: _BASE_PROGRAM {
  3070. .CMD=PY_PROGRAM_LINK_EXE
  3071. _ARCADIA_PYTHON_ADDINCL()
  3072. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3073. NO_CHECK_IMPORTS_FOR_VALUE=
  3074. }
  3075. ADD_CHECK_PY_IMPORTS()
  3076. when ($NO_PYTHON_INCLS != "yes") {
  3077. PEERDIR += contrib/libs/python
  3078. }
  3079. when ($USE_ARCADIA_PYTHON == "yes") {
  3080. PEERDIR += library/python/runtime/main
  3081. PEERDIR += contrib/deprecated/python/subprocess32
  3082. when ($PYTHON_SQLITE3 != "no") {
  3083. PEERDIR += contrib/tools/python/src/Modules/_sqlite
  3084. }
  3085. }
  3086. when ($PYTHON_COVERAGE == "yes") {
  3087. PEERDIR+=library/python/coverage
  3088. }
  3089. when ($ARCH_PPC64LE == "yes") {
  3090. _MY_ALLOCATOR=SYSTEM
  3091. }
  3092. otherwise {
  3093. _MY_ALLOCATOR=J
  3094. }
  3095. ALLOCATOR($_MY_ALLOCATOR)
  3096. STRIP()
  3097. when ($BUILD_TYPE == "DEBUG") {
  3098. NO_STRIP=yes
  3099. }
  3100. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3101. NO_STRIP=yes
  3102. }
  3103. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2
  3104. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  3105. SET(MODULE_LANG PY2)
  3106. }
  3107. # tag:python-specific tag:codenav
  3108. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3109. PY3_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"py3yndex $TARGET"}
  3110. }
  3111. otherwise {
  3112. PY3_PROGRAM_LINK_EXE=$LINK_EXE
  3113. }
  3114. # tag:python-specific
  3115. ### @usage: _BASE_PY_PROGRAM #internal
  3116. ###
  3117. ### The base module for all Python 3.x binary programs. Adds linking logic, relevant module properties and
  3118. ### dependency on Python 3.x interpreter. Also adds import tests on all sources including libraries.
  3119. ### Links all Python 3.x libraries and Python 3.x interpreter into itself to form regular executable.
  3120. ### This only compatible with PYTHON3-tagged modules and selects those from multimodules
  3121. ###
  3122. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs/
  3123. module _BASE_PY3_PROGRAM: _BASE_PROGRAM {
  3124. .CMD=PY3_PROGRAM_LINK_EXE
  3125. _ARCADIA_PYTHON3_ADDINCL()
  3126. RUN_CYTHON_SCRIPT=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3127. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON3 $CYTHON_SCRIPT
  3128. PYTHON_TYPE_FOR_CYTHON=PY3
  3129. PEERDIR(library/python/runtime_py3/main)
  3130. when ($PYTHON_SQLITE3 != "no") {
  3131. PEERDIR += contrib/tools/python3/src/Modules/_sqlite
  3132. }
  3133. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3134. NO_CHECK_IMPORTS_FOR_VALUE=
  3135. }
  3136. ADD_CHECK_PY_IMPORTS()
  3137. when ($ARCH_PPC64LE == "yes") {
  3138. _MY_ALLOCATOR=SYSTEM
  3139. }
  3140. otherwise {
  3141. _MY_ALLOCATOR=J
  3142. }
  3143. ALLOCATOR($_MY_ALLOCATOR)
  3144. STRIP()
  3145. when ($NO_PYTHON_INCLS != "yes") {
  3146. PEERDIR+=contrib/libs/python
  3147. }
  3148. when ($BUILD_TYPE == "DEBUG") {
  3149. NO_STRIP=yes
  3150. }
  3151. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  3152. NO_STRIP=yes
  3153. }
  3154. when ($PYTHON_COVERAGE == "yes") {
  3155. PEERDIR+=library/python/coverage
  3156. }
  3157. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  3158. PEERDIR += contrib/python/six
  3159. }
  3160. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  3161. .RESTRICTED=PYTHON3_ADDINCL USE_PYTHON3 PYTHON2_ADDINCL USE_PYTHON2
  3162. SET(MODULE_LANG PY3)
  3163. SET(ANTLR_PYTHON Python3)
  3164. }
  3165. # tag:python-specific
  3166. ### @usage: PY3_PROGRAM_BIN([progname])
  3167. ### Use instead of PY3_PROGRAM only if ya.make with PY3_PROGRAM() included in another ya.make
  3168. ### In all other cases use PY3_PROGRAM
  3169. module PY3_PROGRAM_BIN: _BASE_PY3_PROGRAM {
  3170. # Look's like we cannot avoid copy-paste util ymake supports multiple inheritance
  3171. # We need to attach coverage.extractor to every py_program target, except pytest targets
  3172. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  3173. }
  3174. # tag:java-specific
  3175. JAVA_SWIG_DELIM=JAVA_SWIG_DELIM
  3176. # tag:java-specific
  3177. JDK_REAL_VERSION=
  3178. JDK_VERSION=
  3179. when ($JDK_VERSION == "20") {
  3180. JDK_REAL_VERSION=20
  3181. }
  3182. elsewhen ($JDK_VERSION == "19") {
  3183. JDK_REAL_VERSION=19
  3184. }
  3185. elsewhen ($JDK_VERSION == "18") {
  3186. JDK_REAL_VERSION=18
  3187. }
  3188. elsewhen ($JDK_VERSION == "17") {
  3189. JDK_REAL_VERSION=17
  3190. }
  3191. elsewhen ($JDK_VERSION == "16") {
  3192. JDK_REAL_VERSION=16
  3193. }
  3194. elsewhen ($JDK_VERSION == "15") {
  3195. JDK_REAL_VERSION=15
  3196. }
  3197. elsewhen ($JDK_VERSION == "11") {
  3198. JDK_REAL_VERSION=11
  3199. }
  3200. elsewhen ($JDK_VERSION == "10") {
  3201. JDK_REAL_VERSION=10
  3202. }
  3203. elsewhen ($JDK_VERSION == "8") {
  3204. JDK_REAL_VERSION=8
  3205. }
  3206. elsewhen ($MAPSMOBI_BUILD_TARGET && $OS_ANDROID) {
  3207. JDK_REAL_VERSION=11
  3208. }
  3209. otherwise {
  3210. JDK_REAL_VERSION=17
  3211. }
  3212. # tag:java-specific
  3213. # remove extra peerdir to jdk11 after https://st.yandex-team.ru/DEVTOOLS-8851 is done
  3214. when ($USE_SYSTEM_JDK) {
  3215. JDK_RESOURCE_PEERDIR=
  3216. }
  3217. otherwise {
  3218. when ($JDK_REAL_VERSION == "20") {
  3219. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk20 build/platform/java/jdk/jdk17
  3220. }
  3221. when ($JDK_REAL_VERSION == "19") {
  3222. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk19 build/platform/java/jdk/jdk17
  3223. }
  3224. when ($JDK_REAL_VERSION == "18") {
  3225. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk18 build/platform/java/jdk/jdk17
  3226. }
  3227. when ($JDK_REAL_VERSION == "17") {
  3228. # need jdk11 for spare parts in "host" platform
  3229. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk17 build/platform/java/jdk/jdk11
  3230. }
  3231. when ($JDK_REAL_VERSION == "16") {
  3232. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk16 build/platform/java/jdk/jdk17
  3233. }
  3234. when ($JDK_REAL_VERSION == "15") {
  3235. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk15 build/platform/java/jdk/jdk17
  3236. }
  3237. when ($JDK_REAL_VERSION == "11") {
  3238. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk11 build/platform/java/jdk/jdk17
  3239. }
  3240. when ($JDK_REAL_VERSION == "10") {
  3241. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk10 build/platform/java/jdk/jdk17
  3242. }
  3243. when ($JDK_REAL_VERSION == "8") {
  3244. JDK_RESOURCE_PEERDIR=build/platform/java/jdk/jdk8 build/platform/java/jdk/jdk17
  3245. }
  3246. }
  3247. # tag:java-specific
  3248. when ($JDK_REAL_VERSION == "20") {
  3249. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar20
  3250. }
  3251. when ($JDK_REAL_VERSION == "19") {
  3252. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar18
  3253. }
  3254. when ($JDK_REAL_VERSION == "18") {
  3255. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar18
  3256. }
  3257. when ($JDK_REAL_VERSION == "17") {
  3258. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar17
  3259. }
  3260. when ($JDK_REAL_VERSION == "16") {
  3261. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar16
  3262. }
  3263. when ($JDK_REAL_VERSION == "15") {
  3264. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar15
  3265. }
  3266. when ($JDK_REAL_VERSION == "11") {
  3267. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar11
  3268. }
  3269. when ($JDK_REAL_VERSION == "10") {
  3270. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar10
  3271. }
  3272. when ($JDK_REAL_VERSION == "8") {
  3273. UBERJAR_RESOURCE_PEERDIR=build/platform/java/uberjar/uberjar8
  3274. }
  3275. # tag:java-specific
  3276. JAVAC_OPTS=
  3277. when ($USE_SYSTEM_JDK) {
  3278. JDK_RESOURCE=$USE_SYSTEM_JDK
  3279. }
  3280. otherwise {
  3281. when ($JDK_REAL_VERSION == "20") {
  3282. JDK_RESOURCE=$JDK20_RESOURCE_GLOBAL
  3283. }
  3284. when ($JDK_REAL_VERSION == "19") {
  3285. JDK_RESOURCE=$JDK19_RESOURCE_GLOBAL
  3286. }
  3287. when ($JDK_REAL_VERSION == "18") {
  3288. JDK_RESOURCE=$JDK18_RESOURCE_GLOBAL
  3289. }
  3290. when ($JDK_REAL_VERSION == "17") {
  3291. JDK_RESOURCE=$JDK17_RESOURCE_GLOBAL
  3292. }
  3293. when ($JDK_REAL_VERSION == "16") {
  3294. JDK_RESOURCE=$JDK16_RESOURCE_GLOBAL
  3295. }
  3296. when ($JDK_REAL_VERSION == "15") {
  3297. JDK_RESOURCE=$JDK15_RESOURCE_GLOBAL
  3298. }
  3299. when ($JDK_REAL_VERSION == "11") {
  3300. JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  3301. }
  3302. when ($JDK_REAL_VERSION == "10") {
  3303. JDK_RESOURCE=$JDK10_RESOURCE_GLOBAL
  3304. }
  3305. when ($JDK_REAL_VERSION == "8") {
  3306. JDK_RESOURCE=$JDK8_RESOURCE_GLOBAL
  3307. }
  3308. }
  3309. # tag:java-specific
  3310. when (!$USE_SYSTEM_ERROR_PRONE) {
  3311. # Still not done: DTCC-667
  3312. when ($JDK_REAL_VERSION == "8" || $JDK_REAL_VERSION == "10") {
  3313. ERROR_PRONE_VERSION=2.3.1
  3314. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.3.1
  3315. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_3_1_RESOURCE_GLOBAL
  3316. }
  3317. elsewhen ($JDK_REAL_VERSION == "11" || $JDK_REAL_VERSION == "15" || $JDK_REAL_VERSION == "16") {
  3318. ERROR_PRONE_VERSION=2.7.1
  3319. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.7.1
  3320. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_7_1_RESOURCE_GLOBAL
  3321. }
  3322. elsewhen ($JDK_REAL_VERSION == "17") {
  3323. ERROR_PRONE_VERSION=2.10.0
  3324. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.10.0
  3325. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_10_0_RESOURCE_GLOBAL
  3326. }
  3327. elsewhen ($JDK_REAL_VERSION == "18") {
  3328. ERROR_PRONE_VERSION=2.14.0
  3329. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.14.0
  3330. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_14_0_RESOURCE_GLOBAL
  3331. }
  3332. elsewhen ($JDK_REAL_VERSION == "19") {
  3333. ERROR_PRONE_VERSION=2.18.0
  3334. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.18.0
  3335. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_18_0_RESOURCE_GLOBAL
  3336. }
  3337. elsewhen ($JDK_REAL_VERSION == "20") {
  3338. ERROR_PRONE_VERSION=2.18.0
  3339. ERROR_PRONE_PEERDIR=build/platform/java/error_prone/2.18.0
  3340. ERROR_PRONE_RESOURCE=$ERROR_PRONE_2_18_0_RESOURCE_GLOBAL
  3341. }
  3342. otherwise {
  3343. ERROR_PRONE_VERSION=2.7.1
  3344. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  3345. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  3346. }
  3347. }
  3348. otherwise {
  3349. ERROR_PRONE_VERSION=2.7.1
  3350. ERROR_PRONE_PEERDIR=build/platform/java/error_prone
  3351. ERROR_PRONE_RESOURCE=$ERROR_PRONE_RESOURCE_GLOBAL
  3352. }
  3353. # tag:java-specific
  3354. when ($USE_SYSTEM_UBERJAR) {
  3355. UBERJAR_RESOURCE=$USE_SYSTEM_UBERJAR
  3356. }
  3357. otherwise {
  3358. when ($JDK_REAL_VERSION == "20") {
  3359. UBERJAR_RESOURCE=$UBERJAR20_RESOURCE_GLOBAL
  3360. }
  3361. when ($JDK_REAL_VERSION == "19") {
  3362. UBERJAR_RESOURCE=$UBERJAR18_RESOURCE_GLOBAL
  3363. }
  3364. when ($JDK_REAL_VERSION == "18") {
  3365. UBERJAR_RESOURCE=$UBERJAR18_RESOURCE_GLOBAL
  3366. }
  3367. when ($JDK_REAL_VERSION == "17") {
  3368. UBERJAR_RESOURCE=$UBERJAR17_RESOURCE_GLOBAL
  3369. }
  3370. when ($JDK_REAL_VERSION == "16") {
  3371. UBERJAR_RESOURCE=$UBERJAR16_RESOURCE_GLOBAL
  3372. }
  3373. when ($JDK_REAL_VERSION == "15") {
  3374. UBERJAR_RESOURCE=$UBERJAR15_RESOURCE_GLOBAL
  3375. }
  3376. when ($JDK_REAL_VERSION == "11") {
  3377. UBERJAR_RESOURCE=$UBERJAR11_RESOURCE_GLOBAL
  3378. }
  3379. when ($JDK_REAL_VERSION == "10") {
  3380. UBERJAR_RESOURCE=$UBERJAR10_RESOURCE_GLOBAL
  3381. }
  3382. when ($JDK_REAL_VERSION == "8") {
  3383. UBERJAR_RESOURCE=$UBERJAR8_RESOURCE_GLOBAL
  3384. }
  3385. }
  3386. # tag:java-specific
  3387. when ($JDK_REAL_VERSION == "20") {
  3388. WITH_JDK_RESOURCE=$WITH_JDK20_RESOURCE_GLOBAL
  3389. }
  3390. when ($JDK_REAL_VERSION == "19") {
  3391. WITH_JDK_RESOURCE=$WITH_JDK19_RESOURCE_GLOBAL
  3392. }
  3393. when ($JDK_REAL_VERSION == "18") {
  3394. WITH_JDK_RESOURCE=$WITH_JDK18_RESOURCE_GLOBAL
  3395. }
  3396. when ($JDK_REAL_VERSION == "17") {
  3397. WITH_JDK_RESOURCE=$WITH_JDK17_RESOURCE_GLOBAL
  3398. }
  3399. when ($JDK_REAL_VERSION == "16") {
  3400. WITH_JDK_RESOURCE=$WITH_JDK16_RESOURCE_GLOBAL
  3401. }
  3402. when ($JDK_REAL_VERSION == "15") {
  3403. WITH_JDK_RESOURCE=$WITH_JDK15_RESOURCE_GLOBAL
  3404. }
  3405. when ($JDK_REAL_VERSION == "11") {
  3406. WITH_JDK_RESOURCE=$WITH_JDK11_RESOURCE_GLOBAL
  3407. }
  3408. when ($JDK_REAL_VERSION == "10") {
  3409. WITH_JDK_RESOURCE=$WITH_JDK10_RESOURCE_GLOBAL
  3410. }
  3411. when ($JDK_REAL_VERSION == "8") {
  3412. WITH_JDK_RESOURCE=$WITH_JDK8_RESOURCE_GLOBAL
  3413. }
  3414. # tag:java-specific
  3415. EXTERNAL_JAVA_JDK_RESOURCE=
  3416. EXTERNAL_JAVA_EXTRA_PEERDIR=
  3417. when ($USE_SYSTEM_JDK) {
  3418. EXTERNAL_JAVA_EXTRA_PEERDIR=
  3419. EXTERNAL_JAVA_JDK_RESOURCE=$USE_SYSTEM_JDK
  3420. }
  3421. elsewhen ($JDK_VERSION == "") {
  3422. EXTERNAL_JAVA_JDK_RESOURCE=$JDK11_RESOURCE_GLOBAL
  3423. EXTERNAL_JAVA_EXTRA_PEERDIR=build/platform/java/jdk/jdk11
  3424. }
  3425. otherwise {
  3426. EXTERNAL_JAVA_JDK_RESOURCE=$JDK_RESOURCE
  3427. }
  3428. COMPILE_JAVA=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_java.py"} --java-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/java --javac-bin $EXTERNAL_JAVA_JDK_RESOURCE/bin/javac --jar-bin $JDK_RESOURCE/bin/jar --kotlin-compiler $KOTLIN_COMPILER_RESOURCE_GLOBAL/kotlin-compiler.jar $JAVA_VCS_MF_ARG $PACKAGE_PREFIX_ARGS --jar-output $TARGET --srcs-jar-output ${output;suf=-sources.jar:REALPRJNAME} $AUTO_INPUT DELIM $JAVAC_OPTS DELIM $MANAGED_PEERS_CLOSURE DELIM -no-stdlib -module-name $REALPRJNAME -jvm-target ${KOTLIN_JVM_TARGET} ${KOTLINC_OPTS_VALUE} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} ${requirements;hide:"cpu:2"}
  3429. ARGS_DELIM="MACRO_CALLS_DELIM"
  3430. SYSTEM_PROPERTIES_VALUE=
  3431. ### @usage: SYSTEM_PROPERTIES([<Key Value>...] [<File Path>...])
  3432. ###
  3433. ### List of Key,Value pairs that will be available to test via System.getProperty().
  3434. ### FILE means that parst should be read from file specifies as Path.
  3435. ###
  3436. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3437. macro SYSTEM_PROPERTIES(Args...) {
  3438. SET_APPEND(SYSTEM_PROPERTIES_VALUE $Args)
  3439. }
  3440. # tag:java-specific
  3441. JVM_ARGS_VALUE=
  3442. ### @usage: JVM_ARGS(Args...)
  3443. ###
  3444. ### Arguments to run Java programs in tests.
  3445. ###
  3446. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3447. macro JVM_ARGS(Args...) {
  3448. SET_APPEND(JVM_ARGS_VALUE $Args)
  3449. }
  3450. # tag:java-specific
  3451. CHECK_JAVA_DEPS_VALUE=
  3452. ### @usage: CHECK_JAVA_DEPS(<yes|no>)
  3453. ###
  3454. ### Check for different classes with duplicate name in classpath.
  3455. ###
  3456. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3457. macro CHECK_JAVA_DEPS(Arg) {
  3458. SET(CHECK_JAVA_DEPS_VALUE $Arg)
  3459. }
  3460. ERROR_PRONE_VALUE=
  3461. ### @usage: USE_ERROR_PRONE()
  3462. ###
  3463. ### Use errorprone instead of javac for .java compilation.
  3464. macro USE_ERROR_PRONE() {
  3465. SET(ERROR_PRONE_VALUE yes)
  3466. }
  3467. TEST_CWD_VALUE=
  3468. ### @usage: TEST_CWD(path)
  3469. ###
  3470. ### Defines working directory for test runs. Often used in conjunction with DATA() macro.
  3471. ### Is only used inside of the TEST modules.
  3472. ###
  3473. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  3474. macro TEST_CWD(Arg) {
  3475. SET(TEST_CWD_VALUE $Arg)
  3476. }
  3477. # tag:java-specific
  3478. MAKE_UBERJAR_VALUE=
  3479. ### @usage: UBERJAR()
  3480. ###
  3481. ### UBERJAR is a single all-in-one jar-archive that includes all its Java dependencies (reachable PEERDIR).
  3482. ### It also supports shading classes inside the archive by moving them to a different package (similar to the maven-shade-plugin).
  3483. ### Use UBERJAR inside JAVA_PROGRAM module.
  3484. ###
  3485. ### You can use the following macros to configure the archive:
  3486. ### 1. UBERJAR_HIDING_PREFIX prefix for classes to shade (classes remain in their packages by default)
  3487. ### 2. UBERJAR_HIDE_EXCLUDE_PATTERN exclude classes matching this patterns from shading (if enabled).
  3488. ### 3. UBERJAR_PATH_EXCLUDE_PREFIX the prefix for classes that should not get into the jar archive (all classes are placed into the archive by default)
  3489. ### 4. UBERJAR_MANIFEST_TRANSFORMER_MAIN add ManifestResourceTransformer class to uberjar processing and specify main-class
  3490. ### 5. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE add ManifestResourceTransformer class to uberjar processing and specify some attribute
  3491. ### 6. UBERJAR_APPENDING_TRANSFORMER add AppendingTransformer class to uberjar processing
  3492. ### 7. UBERJAR_SERVICES_RESOURCE_TRANSFORMER add ServicesResourceTransformer class to uberjar processing
  3493. ###
  3494. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  3495. ###
  3496. ### @see: [JAVA_PROGRAM](#module_JAVA_PROGRAM), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX), [UBERJAR_HIDE_EXCLUDE_PATTERN](#macro_UBERJAR_HIDE_EXCLUDE_PATTERN), [UBERJAR_PATH_EXCLUDE_PREFIX](#macro_UBERJAR_PATH_EXCLUDE_PREFIX)
  3497. macro UBERJAR() {
  3498. SET(MAKE_UBERJAR_VALUE yes)
  3499. DISABLE(PASS_PEERS)
  3500. }
  3501. # tag:java-specific
  3502. UBERJAR_PREFIX_VALUE=
  3503. UBERJAR_PREFIX_FLAG=
  3504. ### @usage: UBERJAR_HIDING_PREFIX(Arg)
  3505. ###
  3506. ### Set prefix for classes to shade. All classes in UBERJAR will be moved into package prefixed with Arg.
  3507. ### Classes remain in their packages by default.
  3508. ###
  3509. ### @see: [UBERJAR](#macro_UBERJAR)
  3510. macro UBERJAR_HIDING_PREFIX(Arg) {
  3511. SET(UBERJAR_PREFIX_VALUE $Arg)
  3512. SET(UBERJAR_PREFIX_FLAG ${pre=--shade-prefix :Arg})
  3513. }
  3514. # tag:java-specific
  3515. UBERJAR_HIDE_EXCLUDE_VALUE=
  3516. UBERJAR_HIDE_EXCLUDE_FLAGS=
  3517. ### @usage: UBERJAR_HIDE_EXCLUDE_PATTERN(Args...)
  3518. ###
  3519. ### Exclude classes matching this patterns from shading (if enabled).
  3520. ### Pattern may contain '*' and '**' globs.
  3521. ### Shading is enabled for UBERJAR program using UBERJAR_HIDING_PREFIX macro. If this macro is not specified all classes are shaded.
  3522. ###
  3523. ### @see: [UBERJAR](#macro_UBERJAR), [UBERJAR_HIDING_PREFIX](#macro_UBERJAR_HIDING_PREFIX)
  3524. macro UBERJAR_HIDE_EXCLUDE_PATTERN(Args...) {
  3525. SET_APPEND(UBERJAR_HIDE_EXCLUDE_VALUE $ARGS_DELIM $Args)
  3526. SET_APPEND(UBERJAR_HIDE_EXCLUDE_FLAGS ${pre=--shade-exclude :Args})
  3527. }
  3528. # tag:java-specific
  3529. UBERJAR_PATH_EXCLUDES=
  3530. UBERJAR_PATH_EXCLUDE_VALUE=
  3531. ### @usage: UBERJAR_PATH_EXCLUDE_PREFIX(Args...)
  3532. ###
  3533. ### Exclude classes matching this patterns from UBERJAR.
  3534. ### By default all dependencies of UBERJAR program will lend in a .jar archive.
  3535. ###
  3536. ### @see: [UBERJAR](#macro_UBERJAR)
  3537. macro UBERJAR_PATH_EXCLUDE_PREFIX(Args...) {
  3538. SET_APPEND(UBERJAR_PATH_EXCLUDE_VALUE $ARGS_DELIM $Args)
  3539. SET_APPEND(UBERJAR_PATH_EXCLUDES ${pre=--uber-exclude :Args})
  3540. }
  3541. # tag:java-specific
  3542. UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE=
  3543. UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG=
  3544. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main)
  3545. ###
  3546. ### Transform manifest.mf for UBERJAR() java programs, set main-class attribute
  3547. ###
  3548. ### @see: [UBERJAR](#macro_UBERJAR)
  3549. macro UBERJAR_MANIFEST_TRANSFORMER_MAIN(Main) {
  3550. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_VALUE $Main)
  3551. SET(UBERJAR_MANIFEST_TRANSFORMER_MAIN_FLAG --manifest-main $Main)
  3552. }
  3553. # tag:java-specific
  3554. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE=
  3555. UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS=
  3556. ### @usage: UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value)
  3557. ###
  3558. ### Transform manifest.mf for UBERJAR() java programs, set attribute
  3559. ###
  3560. ### @see: [UBERJAR](#macro_UBERJAR)
  3561. macro UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE(Key, Value) {
  3562. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_VALUE $ARGS_DELIM $Key : $Value)
  3563. SET_APPEND(UBERJAR_MANIFEST_TRANSFORMER_ATTRIBUTE_FLAGS --manifest-attribute ${Key}:${Value})
  3564. }
  3565. # tag:java-specific
  3566. UBERJAR_APPENDING_TRANSFORMER_VALUE=
  3567. UBERJAR_APPENDING_TRANSFORMER_FLAGS=
  3568. ### @usage: UBERJAR_APPENDING_TRANSFORMER(Resource)
  3569. ###
  3570. ### Add AppendingTransformer for UBERJAR() java programs
  3571. ###
  3572. ### Parameters:
  3573. ### - Resource - Resource name
  3574. ###
  3575. ### @see: [UBERJAR](#macro_UBERJAR)
  3576. macro UBERJAR_APPENDING_TRANSFORMER(Resources...) {
  3577. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_VALUE $ARGS_DELIM $Resources)
  3578. SET_APPEND(UBERJAR_APPENDING_TRANSFORMER_FLAGS ${pre=--append-transformer :Resources})
  3579. }
  3580. # tag:java-specific
  3581. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE=
  3582. UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG=
  3583. ### @usage: UBERJAR_SERVICES_RESOURCE_TRANSFORMER()
  3584. ###
  3585. ### Add ServicesResourceTransformer for UBERJAR() java programs
  3586. ###
  3587. ### @see: [UBERJAR](#macro_UBERJAR)
  3588. macro UBERJAR_SERVICES_RESOURCE_TRANSFORMER() {
  3589. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_VALUE yes)
  3590. SET(UBERJAR_SERVICES_RESOURCE_TRANSFORMER_FLAG --service-transformer)
  3591. }
  3592. # tag:idea-specific
  3593. IDEA_EXCLUDE_DIRS_VALUE=
  3594. ### @usage: IDEA_EXCLUDE_DIRS(<excluded dirs>)
  3595. ###
  3596. ### Exclude specified directories from an idea project generated by ya ide idea
  3597. ### Have no effect on regular build.
  3598. macro IDEA_EXCLUDE_DIRS(Args...) {
  3599. SET_APPEND(IDEA_EXCLUDE_DIRS_VALUE $Args)
  3600. }
  3601. # tag:idea-specific
  3602. IDEA_RESOURCE_DIRS_VALUE=
  3603. ### @usage: IDEA_RESOURCE_DIRS(<additional dirs>)
  3604. ###
  3605. ### Set specified resource directories in an idea project generated by ya ide idea
  3606. ### Have no effect on regular build.
  3607. macro IDEA_RESOURCE_DIRS(Args...) {
  3608. SET_APPEND(IDEA_RESOURCE_DIRS_VALUE $Args)
  3609. }
  3610. # tag:idea-specific
  3611. IDEA_MODULE_NAME_VALUE=
  3612. ### @usage: IDEA_MODULE_NAME(module_name)
  3613. ###
  3614. ### Set module name in an idea project generated by ya ide idea
  3615. ### Have no effect on regular build.
  3616. macro IDEA_MODULE_NAME(Name) {
  3617. SET(IDEA_MODULE_NAME_VALUE $Name)
  3618. }
  3619. # tag:java-specific
  3620. JAVAC_FLAGS_VALUE=
  3621. ### @usage: JAVAC_FLAGS(Args...)
  3622. ###
  3623. ### Set additional Java compilation flags.
  3624. macro JAVAC_FLAGS(Args...) {
  3625. SET_APPEND(JAVAC_OPTS $Args)
  3626. SET_APPEND(JAVAC_FLAGS_VALUE $ARGS_DELIM $Args)
  3627. }
  3628. # tag:java-specific
  3629. ENABLE_PREVIEW_VALUE=
  3630. ### @usage: ENABLE_PREVIEW()
  3631. ###
  3632. ### Enable java preview features.
  3633. macro ENABLE_PREVIEW() {
  3634. SET_APPEND(JVM_ARGS_VALUE --enable-preview)
  3635. SET_APPEND(JAVAC_OPTS --enable-preview --release $JDK_REAL_VERSION)
  3636. SET_APPEND(JAVAC_FLAGS_VALUE --enable-preview --release $JDK_REAL_VERSION)
  3637. SET(ENABLE_PREVIEW_VALUE yes)
  3638. }
  3639. # tag:java-specific
  3640. SAVE_JAVAC_GENERATED_SRCS=
  3641. SAVE_JAVAC_GENERATED_SRCS_DIR=
  3642. SAVE_JAVAC_GENERATED_SRCS_TAR=
  3643. when ($SAVE_JAVAC_GENERATED_SRCS) {
  3644. SAVE_JAVAC_GENERATED_SRCS_DIR=${BINDIR}/__javac_generated_srcs__
  3645. SAVE_JAVAC_GENERATED_SRCS_TAR=${BINDIR}/javac_generated.tar
  3646. JAVAC_FLAGS_VALUE+=-s $SAVE_JAVAC_GENERATED_SRCS_DIR
  3647. }
  3648. # tag:java-specific
  3649. # TODO: MAVEN_GROUP_ID_VALUE is only used by jbuild remove it after YMAKE-45 and YMAKE-46
  3650. MAVEN_GROUP_ID_VALUE=
  3651. MAVEN_EXPORT_GOUP_ID=ru.yandex
  3652. ### @usage: MAVEN_GROUP_ID(group_id_for_maven_export)
  3653. ###
  3654. ### Set maven export group id for JAVA_PROGRAM() and JAVA_LIBRARY().
  3655. ### Have no effect on regular build.
  3656. macro MAVEN_GROUP_ID(Arg, VERSION="no") {
  3657. SET(MAVEN_GROUP_ID_VALUE $Arg)
  3658. SET(MAVEN_EXPORT_GOUP_ID $Arg)
  3659. SET(PUBLISH_MAVEN_VERSION $VERSION)
  3660. }
  3661. # tag:java-specific
  3662. ANNOTATION_PROCESSOR_VALUE=
  3663. ### @usage: ANNOTATION_PROCESSOR(processors...)
  3664. ###
  3665. ### The macro is in development.
  3666. ### Used to specify annotation processors to build JAVA_PROGRAM() and JAVA_LIBRARY().
  3667. macro ANNOTATION_PROCESSOR(Args...) {
  3668. SET_APPEND(ANNOTATION_PROCESSOR_VALUE $ARGS_DELIM $Args)
  3669. }
  3670. EXCLUDE_VALUE=
  3671. ### EXCLUDE(prefixes)
  3672. ###
  3673. ### The macro is in development.
  3674. ### Specifies which libraries should be excluded from the classpath.
  3675. macro EXCLUDE(Args...) {
  3676. SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args)
  3677. }
  3678. # tag:java-specific
  3679. JAVA_SRCS_VALUE=
  3680. ### @usage: JAVA_SRCS(srcs)
  3681. ###
  3682. ### Specify java source files and resources. A macro can be contained in any of four java modules.
  3683. ### Keywords:
  3684. ### 1. X SRCDIR - specify the directory x is performed relatively to search the source code for these patterns. If there is no SRCDIR, the source will be searched relative to the module directory.
  3685. ### 2. PACKAGE_PREFIX x - use if source paths relative to the SRCDIR does not coincide with the full class names. For example, if all sources of module are in the same package, you can create a directory package/name , and just put the source code in the SRCDIR and specify PACKAGE_PREFIX package.name.
  3686. ###
  3687. ### @example:
  3688. ### - example/ya.make
  3689. ###
  3690. ### JAVA_PROGRAM()
  3691. ### JAVA_SRCS(SRCDIR src/main/java **/*)
  3692. ### END()
  3693. ###
  3694. ### - example/src/main/java/ru/yandex/example/HelloWorld.java
  3695. ###
  3696. ### package ru.yandex.example;
  3697. ### public class HelloWorld {
  3698. ### public static void main(String[] args) {
  3699. ### System.out.println("Hello, World!");
  3700. ### }
  3701. ### }
  3702. ###
  3703. ### Documentation: https://wiki.yandex-team.ru/yatool/java/#javasrcs
  3704. macro JAVA_SRCS(Args...) {
  3705. SET_APPEND(JAVA_SRCS_VALUE $ARGS_DELIM $Args)
  3706. }
  3707. # tag:java-specific
  3708. JAVA_ADD_DLLS_VALUE=no
  3709. macro ADD_DLLS_TO_JAR() {
  3710. SET(JAVA_ADD_DLLS_VALUE yes)
  3711. }
  3712. # tag:java-specific
  3713. MANAGED_PEERS=
  3714. MANAGED_PEERS_CLOSURE=
  3715. RUN_JAVA_PROGRAM_MANAGED=
  3716. MANAGEABLE_PEERS_ROOTS=contrib/java
  3717. HAS_MANAGEABLE_PEERS=no
  3718. PROPAGATES_MANAGEABLE_PEERS=no
  3719. # All items of this list must be PEERS, GHOST PEERS or TOOLS of the test module or module itself.
  3720. # All items of this list must has at least one of HAS_MANAGEABLE_PEERS or PROPAGATES_MANAGEABLE_PEERS flags set yes.
  3721. # This variable is used by JUnit tests but not TestNG.
  3722. TEST_CLASSPATH_VALUE=
  3723. # Calculated and replaced by ymake can be used in DART DATA
  3724. TEST_CLASSPATH_MANAGED=
  3725. # tag:java-specific
  3726. DEPENDENCY_MANAGEMENT_VALUE=
  3727. ### @usage: DEPENDENCY_MANAGEMENT(path/to/lib1 path/to/lib2 ...)
  3728. ###
  3729. ### Lock version of the library from the contrib/java at some point, so that all unversioned PEERDIRs to this library refer to the specified version.
  3730. ###
  3731. ### For example, if the module has PEERDIR (contrib/java/junit/junit), and
  3732. ### 1. specifies DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12),
  3733. ### the PEERDIR is automatically replaced by contrib/java/junit/junit/4.12;
  3734. ### 2. doesn't specify DEPENDENCY_MANAGEMENT, PEERDIR automatically replaced
  3735. ### with the default from contrib/java/junit/junit/ya.make.
  3736. ### These defaults are always there and are supported by maven-import, which puts
  3737. ### there the maximum version available in contrib/java.
  3738. ###
  3739. ### The property is transitive. That is, if module A PEERDIRs module B, and B has PEERDIR(contrib/java/junit/junit), and this junit was replaced by junit-4.12, then junit-4.12 will come to A through B.
  3740. ###
  3741. ### If some module has both DEPENDENCY_MANAGEMENT(contrib/java/junit/junit/4.12) and PERDIR(contrib/java/junit/junit/4.11), the PEERDIR wins.
  3742. ###
  3743. ### Documentation: https://wiki.yandex-team.ru/yatool/java/
  3744. macro DEPENDENCY_MANAGEMENT(Args...) {
  3745. SET_APPEND(DEPENDENCY_MANAGEMENT_VALUE $ARGS_DELIM $Args)
  3746. _GHOST_PEERDIR($Args)
  3747. }
  3748. # tag:java-specific
  3749. WITH_JDK_VALUE=
  3750. ### @usage: WITH_JDK()
  3751. ###
  3752. ### Add directory with JDK to JAVA_PROGRAM output
  3753. macro WITH_JDK() {
  3754. SET(WITH_JDK_VALUE yes)
  3755. }
  3756. # tag:kotlin-specific
  3757. WITH_KOTLIN_VALUE=
  3758. ### @usage: WITH_KOTLIN()
  3759. ###
  3760. ### Compile kotlin source code in this java module
  3761. macro WITH_KOTLIN() {
  3762. SET(WITH_KOTLIN_VALUE yes)
  3763. }
  3764. # tag:kotlin-specific
  3765. WITH_KAPT_VALUE=
  3766. ### @usage: WITH_KAPT()
  3767. ###
  3768. ### Use kapt for as annotation processor
  3769. macro WITH_KAPT() {
  3770. SET(WITH_KAPT_VALUE yes)
  3771. }
  3772. # tag:java-specific
  3773. WITH_GROOVY_VALUE=
  3774. ### @usage: WITH_GROOVY()
  3775. ###
  3776. ### Compile groovy source code in this java module
  3777. macro WITH_GROOVY() {
  3778. SET(WITH_GROOVY_VALUE yes)
  3779. }
  3780. # tag:kotlin-specific
  3781. KOTLINC_FLAGS_VALUE=-Xjvm-default=all
  3782. ### @usage: KOTLINC_FLAGS(-flags)
  3783. ###
  3784. ### Set additional Kotlin compilation flags.
  3785. macro KOTLINC_FLAGS(Args...) {
  3786. SET_APPEND(KOTLINC_OPTS_VALUE $Args)
  3787. }
  3788. # tag:kotlin-sppecific
  3789. WITH_KOTLINC_PLUGIN_ALLOPEN=
  3790. macro _WITH_KOTLINC_ALLOPEN(Options...) {
  3791. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.allopen\::Options})
  3792. SET(WITH_KOTLINC_PLUGIN_ALLOPEN yes)
  3793. }
  3794. # tag:kotlin-specific
  3795. ### @usage: WITH_KOTLINC_ALLOPEN(-flags)
  3796. ###
  3797. ### Enable allopen kotlin compiler plugin https://kotlinlang.org/docs/all-open-plugin.html
  3798. macro WITH_KOTLINC_ALLOPEN(HEAD, TAIL...) {
  3799. _WITH_KOTLINC_ALLOPEN($HEAD $TAIL)
  3800. }
  3801. # tag:kotlin-specific
  3802. WITH_KOTLINC_PLUGIN_LOMBOK=
  3803. ### @usage: WITH_KOTLINC_LOMBOK(-flags)
  3804. ###
  3805. ### Enable lombok kotlin compiler plugin https://kotlinlang.org/docs/lombok.html
  3806. macro WITH_KOTLINC_LOMBOK(Options...) {
  3807. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.lombok\::Options})
  3808. SET(WITH_KOTLINC_PLUGIN_LOMBOK yes)
  3809. }
  3810. # tag:kotlin-specific
  3811. WITH_KOTLINC_PLUGIN_NOARG=
  3812. ### @usage: WITH_KOTLINC_NOARG(-flags)
  3813. ###
  3814. ### Enable noarg kotlin compiler plugin https://kotlinlang.org/docs/no-arg-plugin.html
  3815. macro WITH_KOTLINC_NOARG(Options...) {
  3816. SET_APPEND(KOTLINC_OPTS_VALUE ${pre=-P plugin\:org.jetbrains.kotlin.noarg\::Options})
  3817. SET(WITH_KOTLINC_PLUGIN_NOARG yes)
  3818. }
  3819. # tag:kotlin-specific
  3820. WITH_KOTLINC_PLUGIN_SERIALIZATION=
  3821. ### @usage: WITH_KOTLINC_SERIALIZATION()
  3822. ###
  3823. ### Enable serialization kotlin compiler plugin https://kotlinlang.org/docs/serialization.html
  3824. macro WITH_KOTLINC_SERIALIZATION() {
  3825. SET(WITH_KOTLINC_PLUGIN_SERIALIZATION yes)
  3826. }
  3827. # tag:kotlin-specific
  3828. ### Also search for _KAPT_OPTS and change version there
  3829. KOTLIN_VERSION=1.8.20
  3830. KOTLIN_BOM_FILE=${ARCADIA_ROOT}/contrib/java/org/jetbrains/kotlin/kotlin-bom/1.8.20/ya.dependency_management.inc
  3831. GROOVY_VERSION=3.0.5
  3832. # tag:java-specific
  3833. DIRECT_DEPS_ONLY_VALUE=
  3834. ### @usage: DIRECT_DEPS_ONLY
  3835. ###
  3836. ### Add direct PEERDIR's only in java compile classpath
  3837. macro DIRECT_DEPS_ONLY() {
  3838. SET(DIRECT_DEPS_ONLY_VALUE yes)
  3839. }
  3840. # tag:java-specific
  3841. JAVA_EXTERNAL_DEPENDENCIES_VALUE=
  3842. ### @usage: JAVA_EXTERNAL_DEPENDENCIES(file1 file2 ...)
  3843. ###
  3844. ### Add non-source java external build dependency (like lombok config file)
  3845. macro JAVA_EXTERNAL_DEPENDENCIES(Args...) {
  3846. SET_APPEND(JAVA_EXTERNAL_DEPENDENCIES_VALUE $Args)
  3847. }
  3848. # tag:java-specific
  3849. JAVA_CLASSPATH_CMD_TYPE_VALUE=
  3850. # tag:java-specific
  3851. ### @usage:TEST_JAVA_CLASSPATH_CMD_TYPE(Type)
  3852. ### Available types: MANIFEST(default), COMMAND_FILE, LIST
  3853. ### Method for passing a classpath value to a java command line
  3854. ### MANIFEST via empty jar file with manifest that contains Class-Path attribute
  3855. ### COMMAND_FILE via @command_file
  3856. ### LIST via flat args
  3857. macro TEST_JAVA_CLASSPATH_CMD_TYPE(Type) {
  3858. SET(JAVA_CLASSPATH_CMD_TYPE_VALUE $Type)
  3859. }
  3860. # tag:java-specific
  3861. IGNORE_JAVA_DEPENDENCIES_CONFIGURATION=no
  3862. JAVA_DEPENDENCIES_CONFIGURATION_VALUE=
  3863. # tag:java-specific
  3864. ### @usage JAVA_DEPENDENCIES_CONFIGURATION(Vetos...)
  3865. ### Validate contrib/java dependencies
  3866. ### Valid arguments
  3867. ### FORBID_DIRECT_PEERDIRS - fail when module have direct PEERDIR (with version) (non-transitive)
  3868. ### FORBID_CONFLICT - fail when module have resolved without DEPENDENCY_MANAGEMENT version conflict (transitive)
  3869. ### FORBID_CONFLICT_DM - fail when module have resolved with DEPENDENCY_MANAGEMENT version conflict (transitive)
  3870. ### FORBID_CONFLICT_DM_RECENT - like FORBID_CONFLICT_DM but fail only when dependency have more recent version than specified in DEPENDENCY_MANAGEMENT
  3871. ### REQUIRE_DM - all dependencies must be specified in DEPENDENCY_MANAGEMENT (transitive)
  3872. macro JAVA_DEPENDENCIES_CONFIGURATION(Args...) {
  3873. SET_APPEND(JAVA_DEPENDENCIES_CONFIGURATION_VALUE $Args)
  3874. }
  3875. # tag:java-specific
  3876. # TODO(DEVTOOLS-6901): remove this variable when there are no more references to it in jbuild
  3877. JAVA_FORBIDDEN_LIBRARIES_VALUE=
  3878. # tag:java-specific
  3879. JAR_INCLUDE_FILTER_VALUE=
  3880. JAR_EXCLUDE_FILTER_VALUE=
  3881. # tag:java-specific
  3882. ### @usage:JAR_INCLUDE(Filters...)
  3883. ### Filter .jar file content: keep only matched files
  3884. ### * and ** patterns are supported (like JAVA_SRCS)
  3885. macro JAR_INCLUDE(Filters...) {
  3886. SET_APPEND(JAR_INCLUDE_FILTER_VALUE $Filters)
  3887. }
  3888. # tag:java-specific
  3889. ### @usage:JAR_EXCLUDE(Filters...)
  3890. ### Filter .jar file content: remove matched files
  3891. ### * and ** patterns are supported (like JAVA_SRCS)
  3892. macro JAR_EXCLUDE(Filters...) {
  3893. SET_APPEND(JAR_EXCLUDE_FILTER_VALUE $Filters)
  3894. }
  3895. # tag:sandbox-specific
  3896. ### @usage: SANDBOX_TASK([Name])
  3897. ###
  3898. ### Multimodule describing Sandbox task (Python code that can be executed by Sandbox system).
  3899. ###
  3900. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_TASKs as libraries.
  3901. ### The final artifact is provided when SANDBOX_TASK is referred to by DEPENDS and BUNDLE macros.
  3902. ### As PEERDIR target, it works like regular PY2_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_TASKs.
  3903. ###
  3904. ### Currently Sandbox supports only Python 2.x, so both variants will be compatible only with Python 2.x modules
  3905. ### and will select multimodule variants accordingly.
  3906. ###
  3907. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  3908. multimodule SANDBOX_TASK {
  3909. module SB_TASK_BIN: _PY2_PROGRAM {
  3910. PY_MAIN(sandbox.taskbox.binary)
  3911. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  3912. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  3913. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  3914. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  3915. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  3916. REGISTER_SANDBOX_IMPORT(${MODDIR})
  3917. when ($FAIL_PY2 == "yes") {
  3918. _OK=no
  3919. }
  3920. elsewhen ($OPENSOURCE != "yes") {
  3921. PEERDIR+=build/rules/py2_deprecation
  3922. }
  3923. ASSERT(_OK You are using deprecated Python2-only code (SANDBOX_TASK). Please consider rewriting to 2/3-compatible code.)
  3924. }
  3925. module PY2: PY2_LIBRARY {
  3926. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  3927. REGISTER_SANDBOX_IMPORT(${MODDIR})
  3928. }
  3929. }
  3930. # tag:sandbox-specific
  3931. multimodule SANDBOX_PY23_TASK {
  3932. module SB_TASK_BIN: _PY2_PROGRAM {
  3933. .RESTRICTED=RUN_ANTLR4_PYTHON
  3934. PY_MAIN(sandbox.taskbox.binary)
  3935. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/sandboxsdk sandbox/taskbox/worker)
  3936. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  3937. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  3938. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  3939. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  3940. REGISTER_SANDBOX_IMPORT(${MODDIR})
  3941. }
  3942. module PY2: PY2_LIBRARY {
  3943. .RESTRICTED=RUN_ANTLR4_PYTHON
  3944. PEERDIR(sandbox/sdk2 sandbox/sandboxsdk)
  3945. REGISTER_SANDBOX_IMPORT(${MODDIR})
  3946. OBJ_SUF=.py2
  3947. }
  3948. module PY3: PY3_LIBRARY {
  3949. .RESTRICTED=RUN_ANTLR4_PYTHON
  3950. when ($MSVC == "yes" || $CYGWIN == "yes") {
  3951. MODULE_PREFIX=py3
  3952. }
  3953. otherwise {
  3954. MODULE_PREFIX=libpy3
  3955. }
  3956. OBJ_SUF=.py3
  3957. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  3958. PEERDIR(sandbox/sdk2)
  3959. REGISTER_SANDBOX_IMPORT(${MODDIR})
  3960. }
  3961. }
  3962. # tag:sandbox-specific
  3963. ### @usage: SANDBOX_PY3_TASK([Name])
  3964. ###
  3965. ### Multimodule describing Sandbox task (Python3 code that can be executed by Sandbox system).
  3966. ###
  3967. ### When being a final target, this multimodule builds Sandbox binary task. It may PEERDIR other SANDBOX_PY3_TASKs as libraries.
  3968. ### The final artifact is provided when SANDBOX_PY3_TASK is referred to by DEPENDS and BUNDLE macros.
  3969. ### As PEERDIR target, it works like regular PY3_LIBRARY with predefined dependencies on Sandbox SDK to allow code reuse among SANDBOX_PY3_TASKs.
  3970. ###
  3971. ### Currently Sandbox supports Python 3.x only in binary tasks, both variants will be compatible only with Python 3.x and py23 libraries
  3972. ### and will select multimodule variants accordingly.
  3973. ###
  3974. ### Documentation: https://wiki.yandex-team.ru/sandbox/tasks/binary
  3975. multimodule SANDBOX_PY3_TASK {
  3976. module SB_TASK_BIN: PY3_PROGRAM_BIN {
  3977. .IGNORED=RUN_ANTLR4_PYTHON
  3978. PY_MAIN(sandbox.taskbox.binary)
  3979. PEERDIR(sandbox/bin sandbox/sdk2 sandbox/taskbox/worker)
  3980. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE api.*)
  3981. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE kernel.*)
  3982. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE library.*)
  3983. SET_APPEND(NO_CHECK_IMPORTS_FOR_VALUE sky*)
  3984. REGISTER_SANDBOX_IMPORT(${MODDIR})
  3985. }
  3986. module PY3: PY3_LIBRARY {
  3987. PEERDIR(sandbox/sdk2)
  3988. REGISTER_SANDBOX_IMPORT(${MODDIR})
  3989. }
  3990. }
  3991. # tag:python-specific tag:internal
  3992. NO_PYTHON_INCLS=no
  3993. ### @usage: NO_PYTHON_INCLUDES() # internal
  3994. ###
  3995. ### Disable dependencies on libraries providing Python headers.
  3996. ### This is only used in Python libraries themselves to avoid PEERDIR loops.
  3997. macro NO_PYTHON_INCLUDES() {
  3998. ENABLE(NO_PYTHON_INCLS)
  3999. }
  4000. # tag:python-specific
  4001. ### @usage: PYTHON2_ADDINCL()
  4002. ###
  4003. ### This macro adds include path for Python headers (Python 2.x variant) without PEERDIR.
  4004. ### This should be used in 2 cases only:
  4005. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4006. ### - In system Python libraries themselves since proper PEERDIR there may create a loop;
  4007. ### In all other cases use USE_PYTHON2 macro instead.
  4008. ###
  4009. ### Never use this macro in PY2_PROGRAM, PY2_LIBRARY and PY23_LIBRARY: they have everything needed by default.
  4010. ###
  4011. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4012. macro PYTHON2_ADDINCL() {
  4013. _PYTHON_ADDINCL()
  4014. SET(MODULE_TAG PY2_NATIVE)
  4015. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4016. }
  4017. # tag:python-specific tag:internal
  4018. ### @usage: _ARCADIA_PYTHON_ADDINCL() # internal
  4019. ### This macro sets up Python headers for modules with Arcadia python (e.g. PY2_LIBRARY) and configures module as Python 2.x.
  4020. macro _ARCADIA_PYTHON_ADDINCL() {
  4021. _PYTHON_ADDINCL()
  4022. SET(MODULE_TAG PY2)
  4023. SET(PEERDIR_TAGS PY2 PY2_NATIVE PY_PROTO PY2_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4024. }
  4025. # tag:python-specific tag:internal
  4026. ### @usage: _PYTHON_ADDINCL() # internal
  4027. ### This macro sets up Python 2.x headers for both Arcadia and non-Arcadia python.
  4028. macro _PYTHON_ADDINCL() {
  4029. SET(PYTHON2 yes)
  4030. SET(PYTHON3 no)
  4031. when ($USE_ARCADIA_PYTHON == "yes") {
  4032. ADDINCL+=GLOBAL contrib/libs/python/Include
  4033. CFLAGS+=-DARCADIA_PYTHON_UNICODE_SIZE=$ARCADIA_PYTHON_UNICODE_SIZE
  4034. }
  4035. otherwise {
  4036. when ($USE_SYSTEM_PYTHON) {
  4037. PEERDIR+=build/platform/python
  4038. }
  4039. otherwise {
  4040. CFLAGS+=$PYTHON_INCLUDE
  4041. }
  4042. }
  4043. }
  4044. # tag:python-specific
  4045. ### @usage: PYTHON3_ADDINCL()
  4046. ###
  4047. ### This macro adds include path for Python headers (Python 3.x variant).
  4048. ### This should be used in 2 cases only:
  4049. ### - In PY2MODULE since it compiles into .so and uses external Python runtime;
  4050. ### - In system Python libraries themselves since peerdir there may create a loop;
  4051. ### In all other cases use USE_PYTHON3() macro instead.
  4052. ###
  4053. ### Never use this macro in PY3_PROGRAM and PY3_LIBRARY and PY23_LIBRARY: they have everything by default.
  4054. ###
  4055. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/py_srcs
  4056. macro PYTHON3_ADDINCL() {
  4057. _PYTHON3_ADDINCL()
  4058. SET(MODULE_TAG PY3_NATIVE)
  4059. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY3_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4060. }
  4061. # tag:python-specific tag:internal
  4062. ### @usage: _ARCADIA_PYTHON3_ADDINCL() # internal
  4063. ###
  4064. ### This macro sets up Python3 headers for modules with Arcadia python (e.g. PY3_LIBRARY) and configures module as Python 3.x.
  4065. macro _ARCADIA_PYTHON3_ADDINCL() {
  4066. _PYTHON3_ADDINCL()
  4067. SET(MODULE_TAG PY3)
  4068. SET(MODULE_LANG PY3)
  4069. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE PY3_PROTO PY3_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4070. }
  4071. # tag:python-specific tag:internal
  4072. ### @usage: _PYTHON_ADDINCL() # internal
  4073. ###
  4074. ### This macro sets up Python 3.x headers for both Arcadia and non-Arcadia python.
  4075. macro _PYTHON3_ADDINCL() {
  4076. SET(PYTHON3 yes)
  4077. SET(PYTHON2 no)
  4078. when ($USE_ARCADIA_PYTHON == "yes") {
  4079. CFLAGS+=-DUSE_PYTHON3
  4080. ADDINCL+=GLOBAL contrib/libs/python/Include
  4081. }
  4082. otherwise {
  4083. when ($USE_SYSTEM_PYTHON) {
  4084. PEERDIR+=build/platform/python
  4085. }
  4086. otherwise {
  4087. CFLAGS+=$PYTHON_INCLUDE
  4088. }
  4089. }
  4090. }
  4091. # tag:python-specific
  4092. ### @usage: USE_PYTHON2()
  4093. ###
  4094. ### This adds Python 2.x runtime library to your LIBRARY and makes it Python2-compatible.
  4095. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4096. ###
  4097. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4098. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4099. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4100. ###
  4101. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4102. macro USE_PYTHON2() {
  4103. _ARCADIA_PYTHON_ADDINCL()
  4104. SET(PEERDIR_TAGS PY2 PY2_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4105. PEERDIR(contrib/libs/python)
  4106. }
  4107. # tag:python-specific
  4108. ### @usage: USE_PYTHON3()
  4109. ###
  4110. ### This adds Python3 library to your LIBRARY and makes it Python3-compatible.
  4111. ### Compatibility means proper PEERDIRs, ADDINCLs and variant selection on PEERDIRs to multimodules.
  4112. ###
  4113. ### If you'd like to use #include <Python.h> with Python3 specify USE_PYTHON3 or better make it PY3_LIBRARY.
  4114. ### If you'd like to use #include <Python.h> with Python2 specify USE_PYTHON2 or better make it PY2_LIBRARY.
  4115. ### If you'd like to use #include <Python.h> with both Python2 and Python3 convert your LIBRARY to PY23_LIBRARY.
  4116. ###
  4117. ### @see: [PY2_LIBRARY](#module_PY2_LIBRARY), [PY3_LIBRARY](#module_PY3_LIBRARY), [PY23_LIBRARY](#multimodule_PY23_LIBRARY)
  4118. macro USE_PYTHON3() {
  4119. _ARCADIA_PYTHON3_ADDINCL()
  4120. SET(PEERDIR_TAGS PY3 PY3_BIN_LIB PY3TEST_LIBRARY PY3_NATIVE CPP_PROTO CPP_FBS YQL_UDF_STATIC __EMPTY__ DLL_LIB)
  4121. PEERDIR(contrib/libs/python)
  4122. when ($USE_ARCADIA_PYTHON == "yes") {
  4123. PEERDIR+=library/python/runtime_py3
  4124. }
  4125. }
  4126. # tag:python-specific
  4127. when ($PERL_DEFAULT_PEERDIR == "yes") {
  4128. when (($PERLXS == "yes") || ($PERLXSCPP == "yes") || ($USE_PERL == "yes")) {
  4129. PEERDIR+=build/platform/perl
  4130. }
  4131. }
  4132. # tag:perl-specific
  4133. ### @usage: USE_PERL_LIB()
  4134. ### Add dependency on Perl to your LIBRARY
  4135. macro USE_PERL_LIB() {
  4136. PEERDIR(build/platform/perl)
  4137. }
  4138. # tag:perl-specific
  4139. ### @usage: USE_PERL_514_LIB()
  4140. ### Add dependency on Perl 5.14 to your LIBRARY
  4141. macro USE_PERL_514_LIB() {
  4142. SET(PERL_SDK ubuntu-12)
  4143. SET(PERL_DEFAULT_PEERDIR no)
  4144. PEERDIR(build/platform/perl/5.14)
  4145. }
  4146. # tag:perl-specific
  4147. ### @usage: ADD_PERL_MODULE(Dir ModuleName)
  4148. ### Add dependency on specified Perl module to the library
  4149. macro ADD_PERL_MODULE(Dir, Module) {
  4150. PEERDIR($Dir)
  4151. SET_APPEND(modules $Module)
  4152. }
  4153. # tag:allocator
  4154. ### @usage: ALLOCATOR(Alloc) # Default: LF
  4155. ###
  4156. ### Set memory allocator implementation for the PROGRAM()/DLL() module.
  4157. ### This may only be specified for programs and dlls, use in other modules leads to configuration errors.
  4158. ###
  4159. ### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU", "PROFILED_HU".
  4160. ### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc)
  4161. ### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make)
  4162. ### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make)
  4163. ### - YT - The YTAlloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/ytalloc/impl/ya.make)
  4164. ### - J - The JEMalloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/jemalloc)
  4165. ### - B - The balloc allocator named Pyotr Popov and Anton Samokhvalov
  4166. ### - Discussion: https://ironpeter.at.yandex-team.ru/replies.xml?item_no=126
  4167. ### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc
  4168. ### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved)
  4169. ### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM)
  4170. ### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc)
  4171. ### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc)
  4172. ### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc)
  4173. ### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless)
  4174. ### - SYSTEM - Use target system allocator
  4175. ### - FAKE - Don't link with any allocator
  4176. ### - HU - Huge page allocator by @gulin.
  4177. ### - PROFILED_HU - patched HU. It is a bit slower but has metrics of memory consumption.
  4178. ###
  4179. ### More about allocators in Arcadia: https://wiki.yandex-team.ru/arcadia/allocators/
  4180. macro ALLOCATOR(Alloc) {
  4181. SET(ALLOCATOR $Alloc)
  4182. 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" ]) {
  4183. }
  4184. otherwise {
  4185. PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR
  4186. }
  4187. }
  4188. when ($MIC_ARCH == "yes") {
  4189. CFLAGS+=-mmic
  4190. LDFLAGS+=-mmic
  4191. }
  4192. when ($USE_OPENMP == "yes") {
  4193. PEERDIR+=contrib/libs/openmp
  4194. }
  4195. when ($STRIP == "yes" && $NO_STRIP != "yes") {
  4196. STRIP_FLAG=$LD_STRIP_FLAG
  4197. DWARF_COMMAND=
  4198. GO_LINK_FLAGS_VALUE+=-s
  4199. }
  4200. when ($NO_LINKER_DCE != "yes") {
  4201. DCE_FLAG=$LD_DCE_FLAG
  4202. }
  4203. when ($BT_MINSIZEREL == "yes" || $LINKER_ICF == "yes") {
  4204. ICF_FLAG=$LD_ICF_FLAG
  4205. }
  4206. OBJCOPY_TOOL=$OBJCOPY_TOOL_VENDOR
  4207. OBJDUMP_TOOL=$OBJDUMP_TOOL_VENDOR
  4208. STRIP_TOOL=$STRIP_TOOL_VENDOR
  4209. NEED_BINUTILS_PEERDIR=
  4210. BINUTILS_USED=
  4211. when (!$OBJCOPY_TOOL_VENDOR) {
  4212. OBJCOPY_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objcopy
  4213. NEED_BINUTILS_PEERDIR=yes
  4214. }
  4215. when (!$OBJDUMP_TOOL_VENDOR) {
  4216. OBJDUMP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objdump
  4217. NEED_BINUTILS_PEERDIR=yes
  4218. }
  4219. when (!$STRIP_TOOL_VENDOR) {
  4220. STRIP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/strip
  4221. NEED_BINUTILS_PEERDIR=yes
  4222. }
  4223. SPLIT_DWARF_VALUE=no
  4224. NO_SPLIT_DWARF=no
  4225. when ($OS_DARWIN) {
  4226. SPLIT_DWARF_VALUE=yes
  4227. }
  4228. when ($STRIP_DEBUG_INFO) {
  4229. SPLIT_DWARF_VALUE=yes
  4230. NO_SPLIT_DWARF=no
  4231. }
  4232. ### @usage: SPLIT_DWARF()
  4233. ###
  4234. ### Emit debug info for the PROGRAM/DLL as a separate file <module_name>.debug.
  4235. ### NB: It does not help you to save process RSS but can add problems (see e.g. BEGEMOT-2147).
  4236. macro SPLIT_DWARF() {
  4237. SET(SPLIT_DWARF_VALUE yes)
  4238. }
  4239. ### @usage: NO_SPLIT_DWARF()
  4240. ###
  4241. ### Do NOT emit debug info for the PROGRAM/DLL as a separate file.
  4242. ### On macOS this also means do NOT generate dSym files (faster linkage)
  4243. macro NO_SPLIT_DWARF() {
  4244. SET(SPLIT_DWARF_VALUE no)
  4245. }
  4246. SPLIT_DWARF_OUTPUT=${output;tobindir;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
  4247. when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
  4248. DWARF_COMMAND+= \
  4249. $OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
  4250. $STRIP_TOOL --strip-debug $TARGET && \
  4251. $OBJCOPY_TOOL --remove-section=.gnu_debuglink --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
  4252. BINUTILS_USED=yes
  4253. }
  4254. ### @usage: EXTRALIBS_STATIC(Libs...)
  4255. ###
  4256. ### Add the specified external static libraries to the program link
  4257. macro EXTRALIBS_STATIC(Args...) {
  4258. LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic)
  4259. }
  4260. ### @usage ADD_COMPILABLE_TRANSLATE(Dict Name Options...)
  4261. ###
  4262. ### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library
  4263. macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) {
  4264. __translatename_lower=${tolower:Name}
  4265. __translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp
  4266. RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict})
  4267. }
  4268. ### @usage ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...)
  4269. ###
  4270. ### Generate transliteration dictionary code
  4271. ### This will emit both translit, untranslit and ngrams table codes those will be than further compiled into library
  4272. macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) {
  4273. __translitname_lower=${tolower:Name}
  4274. __translit_table=${BINDIR}/translit_trie_${__translitname_lower}.cpp
  4275. __untranslit_table=${BINDIR}/untranslit_trie_${__translitname_lower}.cpp
  4276. __ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp
  4277. __gentrie_dir=dict/tools/make_untranslit_trie
  4278. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table})
  4279. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table})
  4280. RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table})
  4281. }
  4282. # tag:python-specific tag:proto tag:deprecated
  4283. ### @usage GENERATE_PY_PROTOS(ProtoFiles...) # deprecated
  4284. ###
  4285. ### Generate python bindings for protobuf files.
  4286. ### Macro is obsolete and not recommended for use!
  4287. macro GENERATE_PY_PROTOS(FILES...) {
  4288. foreach (FILE : $FILES) {
  4289. _PY_PROTO_CMD($FILE)
  4290. }
  4291. }
  4292. # tag:python-specific tag:proto
  4293. macro _GENERATE_PY_PROTOS_INTERNAL(FILES...) {
  4294. foreach (FILE : $FILES) {
  4295. _PY_PROTO_CMD_INTERNAL($FILE)
  4296. }
  4297. }
  4298. # tag:python-specific
  4299. macro _GENERATE_PY_EVS_INTERNAL(FILES...) {
  4300. foreach (FILE : $FILES) {
  4301. _PY_EVLOG_CMD_INTERNAL($FILE)
  4302. }
  4303. }
  4304. macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], INDUCED_DEPS[], OUTPUT_INCLUDES_INP[]) {
  4305. .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"}
  4306. .SEM=copy_file ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST}
  4307. }
  4308. ### @usage: COPY_FILE(File Destination [AUTO] [OUTPUT_INCLUDES Deps...])
  4309. ###
  4310. ### Copy file to build root. It is possible to change both location and the name.
  4311. ###
  4312. ### Parameters:
  4313. ### - File - Source file name.
  4314. ### - Destination - Output file name.
  4315. ### - AUTO - Consider copied file for further processing automatically.
  4316. ### - OUTPUT_INCLUDES output_includes... - Output file dependencies.
  4317. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  4318. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type)
  4319. ### and set of dependencies
  4320. ###
  4321. ### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly
  4322. ### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing.
  4323. macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  4324. .CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  4325. .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination)
  4326. }
  4327. ### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...])
  4328. ###
  4329. ### Copy file to build root the same way as it is done for COPY_FILE, but also
  4330. ### propagates the context of the source file.
  4331. macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  4332. .CMD=$_COPY_FILE_IMPL($FILE $AUTO $DEST OUTPUT_INCLUDES_INP $FILE OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  4333. }
  4334. ### This is to join $ALL_RES_ and $EXT
  4335. macro _ARF_HELPER(Args...) {
  4336. RESOURCE_FILES($Args)
  4337. }
  4338. ### @usage ALL_RESOURCE_FILES(Ext [PREFIX {prefix}] [STRIP {strip}] Dirs...)
  4339. ###
  4340. ### This macro collects all files with extension `Ext` and
  4341. ### Passes them to `RESOURCE_FILES` macro as relative to current directory
  4342. ###
  4343. ### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
  4344. ###
  4345. ### Note: This macro can be used multiple times per ya.make, but only once for each Ext value
  4346. ### Note: Wildcards are not allowed neither as Ext nor in Dirs
  4347. macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
  4348. _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS})
  4349. _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${pre=$ALL_RES_:EXT})
  4350. }
  4351. macro _BUNDLE_TARGET(Target, Destination) {
  4352. .CMD=$MOVE_FILE ${result:Target} ${output;noauto:Destination} ${kv;hide:"p BN"} ${kv;hide:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
  4353. }
  4354. ### @usage: TIMEOUT(TIMEOUT)
  4355. ###
  4356. ### Sets a timeout on test execution
  4357. ###
  4358. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4359. macro TIMEOUT(Time) {
  4360. SET(TEST_TIMEOUT $Time)
  4361. }
  4362. SBR_UID_EXT=""
  4363. # tag:test
  4364. ### @usage: VALIDATE_DATA_RESTART(ext)
  4365. ###
  4366. ### Change uid for resource validation tests. May be useful when sandbox resource ttl is changed, but test status is cached in CI.
  4367. ### You can change ext to change test's uid. For example VALIDATE_DATA_RESTART(X), where is X is current revision.
  4368. macro VALIDATE_DATA_RESTART(Ext) {
  4369. SET(SBR_UID_EXT $Ext)
  4370. }
  4371. # tag:test
  4372. TEST_FORK_MODE=none
  4373. TEST_PARTITION=SEQUENTIAL
  4374. # tag:test
  4375. ### @usage: FORK_TESTS()
  4376. ###
  4377. ### Splits a test run on chunks by test classes.
  4378. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  4379. ###
  4380. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  4381. ###
  4382. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4383. macro FORK_TESTS(MODE...) {
  4384. SET(TEST_FORK_MODE tests)
  4385. SET(TEST_PARTITION $MODE)
  4386. }
  4387. # tag:test
  4388. ### @usage: FORK_SUBTESTS()
  4389. ###
  4390. ### Splits the test run in chunks on subtests.
  4391. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  4392. ###
  4393. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  4394. ###
  4395. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4396. macro FORK_SUBTESTS(MODE...) {
  4397. SET(TEST_FORK_MODE subtests)
  4398. SET(TEST_PARTITION $MODE)
  4399. }
  4400. # tag:test
  4401. ### @usage: SPLIT_FACTOR(x)
  4402. ###
  4403. ### Sets the number of chunks for parallel run tests when used in test module with FORK_TESTS() or FORK_SUBTESTS().
  4404. ### If none of those is specified this macro implies FORK_TESTS().
  4405. ###
  4406. ### Supports C++ ut and PyTest.
  4407. ###
  4408. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4409. macro SPLIT_FACTOR(Factor) {
  4410. SET(TEST_SPLIT_FACTOR $Factor)
  4411. }
  4412. # tag:test
  4413. FORK_TEST_FILES_MODE=
  4414. ### @usage: FORK_TEST_FILES()
  4415. ###
  4416. ### Only for PY2TEST and PY3TEST: splits a file executable with the tests on chunks in the files listed in TEST_SRCS
  4417. ### Compatible with FORK_(SUB)TESTS.
  4418. ###
  4419. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4420. macro FORK_TEST_FILES() {
  4421. SET(FORK_TEST_FILES_MODE on)
  4422. }
  4423. # tag:test
  4424. TEST_SIZE_NAME=SMALL
  4425. ### @usage: SIZE(SMALL/MEDIUM/LARGE)
  4426. ###
  4427. ### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list.
  4428. ### See documentation on test system for more details.
  4429. ###
  4430. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  4431. macro SIZE(Type) {
  4432. SET(TEST_SIZE_NAME $Type)
  4433. }
  4434. ### @usage: JOIN_SRCS(Out Src...)
  4435. ###
  4436. ### Join set of sources into single file named Out and send it for further processing.
  4437. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  4438. ### You should specify file name with the extension as Out. Further processing will be done according this extension.
  4439. macro JOIN_SRCS(Out, Src...) {
  4440. .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"}
  4441. .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"}
  4442. _CONDITIONAL_SRCS($TIDY_VALUE $Src)
  4443. }
  4444. ### @usage: JOIN_SRCS_GLOBAL(Out Src...)
  4445. ###
  4446. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  4447. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  4448. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  4449. macro JOIN_SRCS_GLOBAL(Out, Src...) {
  4450. .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"}
  4451. SRCS(GLOBAL $Out)
  4452. }
  4453. ### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...)
  4454. ###
  4455. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  4456. ### This macro places all files into single file, so will work with any sources.
  4457. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  4458. macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) {
  4459. .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"}
  4460. SRCS(GLOBAL $Out)
  4461. }
  4462. # tag:cpu
  4463. PIC_CFLAGS=
  4464. SSE2_CFLAGS=
  4465. SSE3_CFLAGS=
  4466. SSSE3_CFLAGS=
  4467. SSE41_CFLAGS=
  4468. SSE42_CFLAGS=
  4469. POPCNT_CFLAGS=
  4470. PCLMUL_CFLAGS=
  4471. CX16_FLAGS=
  4472. AVX_CFLAGS=
  4473. AVX2_CFLAGS=
  4474. AVX512_CFLAGS=
  4475. AMX_CFLAGS=
  4476. # tag:cpu
  4477. SSE_DEFINES=
  4478. SSE_CFLAGS=
  4479. SSE4_DEFINES=
  4480. SSE4_CFLAGS=
  4481. XOP_CFLAGS=
  4482. NO_LTO_CFLAGS=
  4483. # tag:cpu
  4484. when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") {
  4485. when ($CLANG || $CLANG_CL || $GCC) {
  4486. PIC_CFLAGS=-fPIC
  4487. SSE2_CFLAGS=-msse2
  4488. SSE3_CFLAGS=-msse3
  4489. SSSE3_CFLAGS=-mssse3
  4490. SSE41_CFLAGS=-msse4.1
  4491. SSE42_CFLAGS=-msse4.2
  4492. XOP_CFLAGS=-mxop
  4493. POPCNT_CFLAGS=-mpopcnt
  4494. PCLMUL_CFLAGS=-mpclmul
  4495. AVX_CFLAGS=-mavx
  4496. # On Intel BMI1, BMI2 and FMA3 instruction sets come together with AVX-2 extension starting with Broadwell / Haswell.
  4497. # See:
  4498. # https://en.wikipedia.org/wiki/FMA_instruction_set
  4499. # https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set
  4500. #
  4501. # AMD implemented FMA3 in Piledriver architecture over AVX (that is, prior to AVX-2 which was introduced in Zen).
  4502. # BMI2 implementation was released by AMD along with AVX-2 support.
  4503. # See:
  4504. # https://en.wikipedia.org/wiki/Template:AMD_x86_CPU_features
  4505. #
  4506. # Due to the above, it looks safe to enable all three extensions whenever AVX-2 is enabled.
  4507. AVX2_CFLAGS=-mavx2 -mfma -mbmi -mbmi2
  4508. # All Intel CPUS with AVX-512 have these instructions except for the Knights Landing / Knights Mill
  4509. # (these are Xeon Phi)
  4510. # See:
  4511. # https://en.wikichip.org/wiki/x86/avx-512
  4512. AVX512_CFLAGS=-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
  4513. # AMX stands Advanced Matrix Extension supported by modern Intel architectures
  4514. # See:
  4515. # https://en.wikipedia.org/wiki/Advanced_Matrix_Extensions
  4516. # https://en.wikichip.org/wiki/x86/amx
  4517. AMX_CFLAGS=-mamx-tile -mamx-int8 ${AVX512_CFLAGS}
  4518. when ($ARCH_X86_64 && $OS_ANDROID != "yes") {
  4519. CX16_FLAGS=-mcx16
  4520. }
  4521. SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1
  4522. SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1
  4523. }
  4524. elsewhen ($MSVC) {
  4525. SSE2_CFLAGS=/D__SSE2__=1
  4526. SSE3_CFLAGS=/D__SSE3__=1
  4527. SSSE3_CFLAGS=/D__SSSE3__=1
  4528. SSE41_CFLAGS=/D__SSE4_1__=1
  4529. SSE42_CFLAGS=/D__SSE4_2__=1
  4530. POPCNT_CFLAGS=/D__POPCNT__=1
  4531. PCLMUL_CFLAGS=/D__PCLMUL__=1
  4532. AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1
  4533. AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1
  4534. AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1
  4535. SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1
  4536. SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1
  4537. }
  4538. SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS
  4539. SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS
  4540. when ($ARCH_I386 && $OS_ANDROID == "yes") {
  4541. USE_SSE4=no
  4542. }
  4543. }
  4544. otherwise {
  4545. USE_SSE4=no
  4546. CPU_CHECK=no
  4547. }
  4548. # tag:cpu
  4549. when ($NOSSE == "yes") {
  4550. USE_SSE4=no
  4551. }
  4552. # tag:cpu
  4553. ### @usage: NO_SSE4()
  4554. ###
  4555. ### Compile module without SSE4
  4556. macro NO_SSE4() {
  4557. SET(USE_SSE4 no)
  4558. }
  4559. # tag:cpu
  4560. ### @usage: NO_CPU_CHECK()
  4561. ###
  4562. ### Compile module without startup CPU features check
  4563. macro NO_CPU_CHECK() {
  4564. SET(CPU_CHECK no)
  4565. }
  4566. ### @usage: ADDINCLSELF()
  4567. ###
  4568. ### The macro adds the -I<project source path> flag to the source compilation flags of the current project.
  4569. macro ADDINCLSELF(FOR="") {
  4570. when($FOR) {
  4571. ADDINCL+=FOR $FOR ${MODDIR}
  4572. }
  4573. otherwise {
  4574. ADDINCL+=${MODDIR}
  4575. }
  4576. }
  4577. COMPILE_OUT_SUFFIX=
  4578. _COMPILE_OUTPUTS=${output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}:SRC}
  4579. _COMPILE_TIME_TRACE_OUTPUTS=${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}.time_trace.json:SRC}
  4580. macro SET_COMPILE_OUTPUTS_MODIFIERS(NOREL?";norel":"") {
  4581. SET(_COMPILE_OUTPUTS \${output;suf=\${OBJECT_SUF}$NOREL:SRC})
  4582. SET(_COMPILE_TIME_TRACE_OUTPUTS \${output;noauto;suf=\${OBJECT_SUF}.time_trace.json$NOREL:SRC})
  4583. }
  4584. # tag:internal
  4585. ### @usage: _ADD_EXTRA_FLAGS_IMPL([GENERATE] Args...) # internal
  4586. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " before $Args when GENERATE
  4587. ### is specified in the list of actual arguments
  4588. macro _ADD_EXTRA_FLAGS_IMPL(GENERATE?" && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS ":"", Args...) {
  4589. .SEM=$GENERATE $Args
  4590. }
  4591. # tag:internal
  4592. ### @usage: _ADD_EXTRA_FLAGS([GENERATE] Args...) # internal
  4593. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " if Args is not empty
  4594. macro _ADD_EXTRA_FLAGS(COMPILE_OUT_SUFFIX="", Args...) {
  4595. .SEM=$_ADD_EXTRA_FLAGS_IMPL(${pre=GENERATE :Args})
  4596. }
  4597. _EMPTY_CMD=
  4598. # tag:src-processing tag:internal
  4599. ### @usage: _SRC(Ext Src Flags) # internal
  4600. ###
  4601. ### Basic building block of extension-based command dispatching
  4602. ### To enable specific extension processing define _SRC() macro with fixed first argument (Ext).
  4603. ### Internal logic will apply this macro to all files with this Ext listed in SRC/SRCS macros or outputs
  4604. ### of other commands (except ones marked as noauto)
  4605. macro _SRC(EXT, SRC, SRCFLAGS...) {
  4606. # Generic macro definition for _SRC (just a placeholder, it does nothing)
  4607. }
  4608. # tag:src-processing
  4609. macro _SRC("swg", SRC, SRCFLAGS...) {
  4610. .CMD=${_SWIG_CMD}
  4611. .ADDINCL=${_SWIG_ADDINCLS}
  4612. .PEERDIR=${_SWIG_PEERDIR}
  4613. .SEM=conan_require_tool swig/4.0.2 && conan_import '"bin, *swig* -> ./bin"' ${input;hide:SRC} ${_SWIG_SEM_TO_MODULE_LINK}
  4614. }
  4615. RODATA_SYMBOL_PREFIX=
  4616. when ($DARWIN == "yes" || $IOS == "yes" || ($WINDOWS == "yes" && $ARCH_TYPE_32 == "yes")) {
  4617. RODATA_SYMBOL_PREFIX=_
  4618. }
  4619. RODATA_ELF_FLAGS=
  4620. when($LINUX == "yes" || $ANDROID == "yes") {
  4621. RODATA_ELF_FLAGS=--elf
  4622. }
  4623. 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})
  4624. when (($ARCH_AARCH64 || $ARCH_ARM || $ARCH_PPC64LE || $ARCH_RISCV32) == "yes") {
  4625. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2cpp.py"} ${noext;nopath:SRC} ${input:SRC} ${output;suf=.cpp:SRC}
  4626. }
  4627. # tag:src-processing
  4628. macro _SRC("rodata", SRC, SRCFLAGS...) {
  4629. .CMD=$RODATA_COMPILE ${hide;kv:"p RD"} ${hide;kv:"pc light-green"}
  4630. .SEM=target_rodata_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} ${input;hide:"build/scripts/rodata2cpp.py"}
  4631. }
  4632. # tag:src-processing
  4633. macro _SRC("S", SRC, SRCFLAGS...) {
  4634. .CMD=$C_COMPILER $C_FLAGS_PLATFORM $CFLAGS $SFLAGS $SRCFLAGS -c -o ${output:SRC.o} ${input:SRC} ${pre=-I:_C__INCLUDE}
  4635. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS) && add_language ASM
  4636. }
  4637. # tag:src-processing
  4638. macro _SRC("s", SRC, SRCFLAGS...) {
  4639. .CMD=$_SRC(S, $SRC $SRCFLAGS)
  4640. }
  4641. # tag:src-processing
  4642. macro _SRC("s79", SRC, SRCFLAGS...) {
  4643. .CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp)
  4644. }
  4645. # tag:src-processing
  4646. macro _SRC("mm", SRC, SRCFLAGS...) {
  4647. .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
  4648. }
  4649. # tag:src-processing
  4650. macro _SRC("fml", SRC, SRCFLAGS...) {
  4651. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output:SRC.inc} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  4652. }
  4653. # tag:src-processing
  4654. macro _SRC("fml2", SRC, SRCFLAGS...) {
  4655. .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"}
  4656. }
  4657. # tag:src-processing
  4658. macro _SRC("fml3", SRC, SRCFLAGS...) {
  4659. .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"}
  4660. }
  4661. # tag:src-processing
  4662. macro _SRC("sfdl", SRC, SRCFLAGS...) {
  4663. .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
  4664. }
  4665. macro _XS_SRCS(SRC, TYPEMAPS[], SRCFLAGS...) {
  4666. .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"}
  4667. }
  4668. # tag:src-processing
  4669. macro _SRC("xs", SRC, SRCFLAGS...) {
  4670. .CMD=$_XS_SRCS($SRC TYPEMAPS $_XSTYPEMAPS $SRCFLAGS)
  4671. }
  4672. # tag:src-processing
  4673. macro _SRC("gperf", SRC, SRCFLAGS...) {
  4674. .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"}
  4675. }
  4676. # tag:src-processing
  4677. macro _SRC("rl", SRC, SRCFLAGS...) {
  4678. .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"}
  4679. }
  4680. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  4681. .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"}
  4682. }
  4683. # tag:src-processing
  4684. macro _SRC("rl5", SRC, SRCFLAGS...) {
  4685. .CMD=$_SRC(rl $SRC $SRCFLAGS)
  4686. }
  4687. # tag:src-processing
  4688. macro _SRC("asp", SRC, SRCFLAGS...) {
  4689. .CMD=$RUN_NO_SANITIZE ${tool:"tools/html2cpp"} ${input:SRC} ${output:SRC.cpp} ${kv;hide:"p HT"} ${kv;hide:"pc yellow"}
  4690. }
  4691. # tag:src-processing
  4692. macro _SRC("rl6", SRC, SRCFLAGS...) {
  4693. .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"}
  4694. .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"}
  4695. }
  4696. # tag:src-processing
  4697. macro _SRC("pln", SRC, SRCFLAGS...) {
  4698. .CMD=$FML_TOOL -b -o ${output;pre=pln.;nopath;noext:SRC.cpp} -f ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  4699. }
  4700. # tag:src-processing
  4701. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  4702. .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"}
  4703. }
  4704. # tag:src-processing
  4705. macro _SRC("ev", SRC, SRCFLAGS...) {
  4706. .CMD=$EVLOG_CMD($SRC)
  4707. .SEM=$EVLOG_CMD($SRC)
  4708. }
  4709. # tag:src-processing
  4710. macro _SRC("proto", SRC, SRCFLAGS...) {
  4711. .CMD=$PROTO_CMD($SRC)
  4712. .SEM=$PROTO_CMD($SRC)
  4713. }
  4714. # tag:src-processing
  4715. macro _SRC("gztproto", SRC, SRCFLAGS...) {
  4716. # _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.
  4717. # descriptor.proto must be resolved as google/protobuf/descriptor.proto
  4718. .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"}
  4719. .PEERDIR=kernel/gazetteer/proto
  4720. }
  4721. # tag:src-processing
  4722. macro _SRC("cfgproto", SRC, SRCFLAGS...) {
  4723. .CMD=$_CPP_CFGPROTO_CMD($SRC)
  4724. }
  4725. # tag:src-processing
  4726. macro _SRC("pyx", SRC, SRCFLAGS...) {
  4727. # Copy-paste from BUILDWITH_CYTHON
  4728. .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"}
  4729. .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
  4730. .ADDINCL=FOR cython contrib/tools/cython/Cython/Includes
  4731. }
  4732. # tag:src-processing
  4733. macro _SRC("in", SRC, SRCFLAGS...) {
  4734. .CMD=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  4735. .SEM=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  4736. }
  4737. macro MANUAL_GENERATION(Outs...) {
  4738. .SEM=IGNORED ${output;hide;noauto:Outs}
  4739. }
  4740. # tag:src-processing
  4741. macro _SRC("sc", SRC, SRCFLAGS...) {
  4742. .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"}
  4743. }
  4744. # tag:src-processing
  4745. macro _SRC("ssqls", SRC, SRCFLAGS...) {
  4746. .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"}
  4747. }
  4748. # tag:src-processing
  4749. macro _SRC("f", SRC, SRCFLAGS...) {
  4750. .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"}
  4751. .PEERDIR=contrib/libs/libf2c
  4752. .ADDINCL=contrib/libs/libf2c
  4753. }
  4754. # tag:src-processing
  4755. macro _SRC("cpp", SRC, SRCFLAGS...) {
  4756. .CMD=$_SRC_cpp($SRC $SRCFLAGS)
  4757. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  4758. }
  4759. # tag:src-processing
  4760. macro _SRC("cxx", SRC, SRCFLAGS...) {
  4761. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  4762. }
  4763. # tag:src-processing
  4764. macro _SRC("cc", SRC, SRCFLAGS...) {
  4765. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  4766. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  4767. }
  4768. # tag:src-processing
  4769. macro _SRC("auxcpp", SRC, SRCFLAGS...) {
  4770. .CMD=$_SRC_cpp($SRC $_FORCE_CPP_FLAGS $SRCFLAGS)
  4771. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($_FORCE_CPP_FLAGS $SRCFLAGS)
  4772. }
  4773. # tag:src-processing
  4774. macro _SRC("C", SRC, SRCFLAGS...) {
  4775. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  4776. }
  4777. # tag:src-processing
  4778. macro _SRC("c", SRC, SRCFLAGS...) {
  4779. .CMD=$_SRC_c($SRC $SRCFLAGS)
  4780. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
  4781. }
  4782. # tag:src-processing
  4783. macro _SRC("m", SRC, SRCFLAGS...) {
  4784. .CMD=$_SRC(c $SRC $SRCFLAGS)
  4785. }
  4786. # tag:src-processing
  4787. macro _SRC("masm", SRC, SRCFLAGS...) {
  4788. .CMD=$_SRC_masm($SRC $SRCFLAGS)
  4789. }
  4790. 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"} \
  4791. && 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 \
  4792. && add_language ASM \
  4793. && conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  4794. 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"} \
  4795. && 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 \
  4796. && add_language ASM \
  4797. && conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  4798. # tag:src-processing
  4799. macro _SRC("yasm", SRC, SRCFLAGS...) {
  4800. .CMD=$_SRC_yasm($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  4801. .SEM=$YASM_SEM
  4802. }
  4803. # tag:src-processing
  4804. macro _SRC("asm", SRC, SRCFLAGS...) {
  4805. .CMD=$_SRC_ASM($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  4806. .SEM=$ASM_SEM
  4807. }
  4808. # tag:src-processing
  4809. macro _SRC("lua", SRC, SRCFLAGS...) {
  4810. .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"}
  4811. .PEERDIR=$LUAJIT_PATH
  4812. }
  4813. NVCC_CFLAGS=
  4814. when ($IDE_MSVS_CALL == "yes") {
  4815. # This is to avoid issues with .pdb from MSVC calling nvcc calling cl
  4816. NVCC_CFLAGS+=/Fd$(TEMP)
  4817. }
  4818. NVCC_STD_VER=14
  4819. when ($MSVC == "yes") {
  4820. NVCC_STD=/std:c++${NVCC_STD_VER}
  4821. }
  4822. otherwise {
  4823. NVCC_STD=-std=c++${NVCC_STD_VER}
  4824. }
  4825. # tag:src-processing
  4826. macro _SRC("cu", SRC, SRCFLAGS...) {
  4827. .CMD=$_SRC_CU_CMD
  4828. .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
  4829. .PEERDIR=$_SRC_CU_PEERDIR
  4830. }
  4831. # tag:src-processing
  4832. macro _SRC("fbs", SRC, SRCFLAGS...) {
  4833. .CMD=$FBS_CMD($SRC, $SRCFLAGS)
  4834. .SEM=$FBS_CMD($SRC, $SRCFLAGS)
  4835. }
  4836. # tag:src-processing
  4837. macro _SRC("fbs64", SRC, SRCFLAGS...) {
  4838. .CMD=$_CPP_FLATC64_CMD($SRC, $SRCFLAGS)
  4839. }
  4840. # tag:src-processing
  4841. macro _SRC("pysrc", SRC, SRCFLAGS...) {
  4842. .CMD=$_SRC_PYSRC($SRC, $SRCFLAGS)
  4843. }
  4844. # tag:src-processing
  4845. # This triggers configure error in attempt to add `ya.make` to SRCS macro or apply automatic processing by extension from codegen
  4846. macro _SRC("make", SRC, SRCFLAGS...) {
  4847. .CMD=
  4848. }
  4849. @import "${CONF_ROOT}/conf/bison_lex.conf"
  4850. # tag:src-processing
  4851. macro _SRC_py2src(SRC, SRCFLAGS...) {
  4852. .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"}
  4853. }
  4854. # tag:src-processing
  4855. macro _SRC_py3src(SRC, SRCFLAGS...) {
  4856. .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"}
  4857. }
  4858. # tag:src-processing python-specific
  4859. when ($PYTHON3 == "yes") {
  4860. MACRO_ALIAS(_SRC_PYSRC _SRC_py3src)
  4861. }
  4862. otherwise {
  4863. MACRO_ALIAS(_SRC_PYSRC _SRC_py2src)
  4864. }
  4865. # tag:src-processing
  4866. macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
  4867. .CMD=$_SRC_C_NODEPS_CMD
  4868. }
  4869. # Custom flags for generated cpp-files. To support another generator:
  4870. # - insert additional file extension before .cpp into generated cpp-file name
  4871. # - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list
  4872. #
  4873. # ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
  4874. # This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
  4875. #
  4876. # cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
  4877. # We use cython==0.29.26 at the time. This issue might be fixed in further versions.
  4878. #
  4879. # flags -fno-profile-instr-generate -fno-coverage-mapping needed to always disable coverage for .pyx, .rl5, .rl6
  4880. # generated sources
  4881. ## tag:src-processing
  4882. when ($CLANG == "yes") {
  4883. _LANG_CFLAGS_FILTER=\
  4884. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl5:SRC} \
  4885. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl6:SRC} \
  4886. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.pyx:SRC}
  4887. }
  4888. otherwise {
  4889. _LANG_CFLAGS_FILTER=\
  4890. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
  4891. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
  4892. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
  4893. }
  4894. # tag:src-processing
  4895. # Magic macro for removing file name from result (file name is passed as unused SKIP parameter)
  4896. macro _FILTER_EXTS(SKIP="", FLAGS...) {
  4897. .CMD=$FLAGS
  4898. }
  4899. # tag:src-processing
  4900. macro _LANG_CFLAGS(SRC) {
  4901. .CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER)
  4902. }
  4903. # tag:src-processing
  4904. # ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
  4905. # Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
  4906. _LANG_CFLAGS_VALUE=
  4907. when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
  4908. _LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
  4909. }
  4910. # Allows to add single compilation unit name to the node's 'kv' section.
  4911. # This is used by the coverage machinery to instrument only the necessary sources
  4912. # when --coverage-prefix-filter <rootrelpath> is specified. For more info see DEVTOOLSSUPPORT-16891
  4913. SCU_NAME_KV=
  4914. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no" && $USE_SCU_VALUE == "yes") {
  4915. SCU_NAME_KV=${hide;kv:"scu_name $KV_VAL"}
  4916. }
  4917. macro _ADD_SCU_NAME(KV_VAL) {
  4918. .CMD=$SCU_NAME_KV
  4919. }
  4920. # tag:src-processing
  4921. macro _SRC_cpp(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  4922. .CMD=$_SRC_CPP_CMD $_ADD_SCU_NAME(${input:SRC})
  4923. }
  4924. # tag:src-processing
  4925. macro _SRC_c(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  4926. .CMD=$_SRC_C_CMD $_ADD_SCU_NAME(${input:SRC})
  4927. }
  4928. # tag:src-processing
  4929. macro _SRC_m(SRC, SRCFLAGS...) {
  4930. .CMD=$_SRC_M_CMD
  4931. }
  4932. # tag:src-processing
  4933. macro _SRC_masm(SRC, SRCFLAGS...) {
  4934. .CMD=$_SRC_MASM_CMD
  4935. }
  4936. # tag:lua-specific
  4937. ### @usage: COMPILE_LUA(Src, [NAME <import_name>])
  4938. ###
  4939. ### Compile LUA source file to object code using LUA 2.0
  4940. ### Optionally override import name which is by default reflects Src name
  4941. macro COMPILE_LUA(Src, NAME="") {
  4942. .CMD=$_SRC(lua, $Src, ${pre=-n :NAME})
  4943. }
  4944. # tag:lua-specific
  4945. ### @usage: _SRC_lua_21(SRC [SRCFLAGS...]) # internal
  4946. ###
  4947. ### Compile LUA source file to object code using LUA 2.1
  4948. macro _SRC_lua_21(SRC, SRCFLAGS...) {
  4949. .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"}
  4950. .PEERDIR=$LUAJIT_21_PATH
  4951. }
  4952. # tag:lua-specific
  4953. ### @usage: COMPILE_LUA_21(Src, [NAME <import_name>])
  4954. ###
  4955. ### Compile LUA source file to object code using LUA 2.1
  4956. ### Optionally override import name which is by default reflects Src name
  4957. macro COMPILE_LUA_21(Src, NAME="") {
  4958. .CMD=$_SRC_lua_21($Src, ${pre=-n :NAME})
  4959. }
  4960. GETTEXT_KEEP_PATH=no
  4961. _MO_OUTPUT=
  4962. when ($GETTEXT_KEEP_PATH == "yes") {
  4963. _MO_OUTPUT=${output;noauto;norel;noext:SRC.mo}
  4964. }
  4965. otherwise {
  4966. _MO_OUTPUT=${output;noauto;nopath;noext;tobindir:SRC.mo}
  4967. }
  4968. # tag:src-processing
  4969. macro _SRC("po", SRC, SRCFLAGS...) {
  4970. .CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
  4971. }
  4972. # tag:ydl-specific
  4973. YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
  4974. YDL_DESC_FLAGS=
  4975. # tag:src-processing tag:ydl-specific
  4976. macro _SRC("ydl", SRC, SRCFLAGS...) {
  4977. .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"}
  4978. .PEERDIR+=statbox/ydl/runtime/cpp
  4979. }
  4980. # tag:ydl-specific
  4981. ### @usage BUILD_YDL_DESC(Input Symbol Output)
  4982. ###
  4983. ### Generate a descriptor for a Symbol located in a ydl module Input, and put it to the file Output.
  4984. ###
  4985. ### @example:
  4986. ###
  4987. ### PACKAGE()
  4988. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  4989. ### END()
  4990. ###
  4991. ### 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.
  4992. macro BUILD_YDL_DESC(Input, Symbol, Output) {
  4993. .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"}
  4994. }
  4995. # tag:ydl-specific
  4996. ### @usage: YDL_DESC_USE_BINARY()
  4997. ###
  4998. ### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
  4999. ###
  5000. ### @example:
  5001. ###
  5002. ### PACKAGE()
  5003. ### YDL_DESC_USE_BINARY()
  5004. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  5005. ### END()
  5006. ###
  5007. ### This will generate descriptor Event.ydld in a binary format.
  5008. macro YDL_DESC_USE_BINARY() {
  5009. YDL_DESC_FLAGS_BINARY= --binary
  5010. SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
  5011. }
  5012. ### @usage SRC(File Flags...)
  5013. ###
  5014. ### Compile single file with extra Flags.
  5015. ### Compilation is driven by the last extension of the File and Flags are specific to corresponding compilation command
  5016. macro SRC(FILE, FLAGS...) {
  5017. _SRC(${lastext:FILE} $FILE $FLAGS)
  5018. }
  5019. ### @usage: SRCS(<[GLOBAL] File> ...)
  5020. ###
  5021. ### 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.
  5022. ### Arcadia Paths from the root and is relative to the project's LIST are supported
  5023. ###
  5024. ### 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.
  5025. ### 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)
  5026. ###
  5027. ### @example:
  5028. ###
  5029. ### LIBRARY(test_global)
  5030. ### SRCS(GLOBAL foo.cpp)
  5031. ### END()
  5032. ###
  5033. ### 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.
  5034. macro SRCS(FILES...) {
  5035. foreach (FILE : $FILES) {
  5036. _SRC(${lastext:FILE} $FILE)
  5037. }
  5038. }
  5039. # tag:c-specific
  5040. macro _SRC_C_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  5041. .CMD=$_SRC_c($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  5042. .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
  5043. }
  5044. macro _SRC_CPP_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  5045. .CMD=$_SRC_cpp($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  5046. .SEM=target_sources_custom $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS
  5047. }
  5048. # tag:src-specific tag:cpp-specific
  5049. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5050. ###
  5051. ### Defenition of generic macro. Report an error that the File with Ext is not
  5052. ### supported by macro MacroName if no appropriate macro specialization is found.
  5053. macro _SRC_CUSTOM_C_CPP(EXT, MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5054. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  5055. }
  5056. # tag:src-specific tag:cpp-specific
  5057. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5058. ###
  5059. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single C file (with .c extension)
  5060. macro _SRC_CUSTOM_C_CPP("c", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5061. _SRC_C_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5062. }
  5063. # tag:src-specific tag:cpp-specific
  5064. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5065. ###
  5066. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cpp extension)
  5067. macro _SRC_CUSTOM_C_CPP("cpp", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5068. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5069. }
  5070. # tag:src-specific tag:cpp-specific
  5071. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5072. ###
  5073. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cxx extension)
  5074. macro _SRC_CUSTOM_C_CPP("cxx", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5075. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5076. }
  5077. # tag:src-specific tag:cpp-specific
  5078. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5079. ###
  5080. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cc extension)
  5081. macro _SRC_CUSTOM_C_CPP("cc", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5082. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5083. }
  5084. # tag:src-specific tag:cpp-specific
  5085. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  5086. ###
  5087. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .C extension)
  5088. macro _SRC_CUSTOM_C_CPP("C", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  5089. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  5090. }
  5091. # tag:src-specific tag:cpp-specific tag:cpu
  5092. ### @uasge SRC_C_SSE2(File Flags...)
  5093. ###
  5094. ### Compile a single C/C++ file with SSE2 and additional Flags
  5095. macro SRC_C_SSE2(FILE, FLAGS...) {
  5096. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE2 $FILE .sse2 $SSE2_CFLAGS $FLAGS)
  5097. }
  5098. # tag:src-specific tag:cpp-specific tag:cpu
  5099. ### @uasge SRC_C_SSE3(File Flags...)
  5100. ###
  5101. ### Compile a single C/C++ file with SSE3 and additional Flags
  5102. macro SRC_C_SSE3(FILE, FLAGS...) {
  5103. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE3 $FILE .sse3 $SSE3_CFLAGS $FLAGS)
  5104. }
  5105. # tag:src-specific tag:cpp-specific tag:cpu
  5106. ### @uasge SRC_C_SSSE3(File Flags...)
  5107. ###
  5108. ### Compile a single C/C++ file with SSSE3 and additional Flags
  5109. macro SRC_C_SSSE3(FILE, FLAGS...) {
  5110. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSSE3 $FILE .ssse3 $SSSE3_CFLAGS $FLAGS)
  5111. }
  5112. # tag:src-specific tag:cpp-specific tag:cpu
  5113. ### @uasge SRC_C_SSE4(File Flags...)
  5114. ###
  5115. ### Compile a single C/C++ file with SSE4 and additional Flags
  5116. macro SRC_C_SSE4(FILE, FLAGS...) {
  5117. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE4 $FILE .sse4 $SSE4_CFLAGS $FLAGS)
  5118. }
  5119. # tag:src-specific tag:cpp-specific tag:cpu
  5120. ### @uasge SRC_C_SSE41(File Flags...)
  5121. ###
  5122. ### Compile a single C/C++ file with SSE4.1 and additional Flags
  5123. macro SRC_C_SSE41(FILE, FLAGS...) {
  5124. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE41 $FILE .sse41 $SSE41_CFLAGS $FLAGS)
  5125. }
  5126. # tag:src-specific tag:cpp-specific tag:cpu
  5127. ### @uasge SRC_C_AVX(File Flags...)
  5128. ###
  5129. ### Compile a single C/C++ file with AVX and additional Flags
  5130. macro SRC_C_AVX(FILE, FLAGS...) {
  5131. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX $FILE .avx $AVX_CFLAGS $FLAGS)
  5132. }
  5133. # tag:src-specific tag:cpp-specific tag:cpu
  5134. ### @uasge SRC_C_AVX2(File Flags...)
  5135. ###
  5136. ### Compile a single C/C++ file with AVX2 and additional Flags
  5137. macro SRC_C_AVX2(FILE, FLAGS...) {
  5138. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX2 $FILE .avx2 $AVX2_CFLAGS $FLAGS)
  5139. }
  5140. # tag:src-specific tag:cpp-specific tag:cpu
  5141. ### @uasge SRC_C_AVX512(File Flags...)
  5142. ###
  5143. ### Compile a single C/C++ file with AVX512 and additional Flags
  5144. macro SRC_C_AVX512(FILE, FLAGS...) {
  5145. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX512 $FILE .avx512 $AVX512_CFLAGS $FLAGS)
  5146. }
  5147. # tag:src-specific tag:cpp-specific tag:cpu
  5148. ### @uasge SRC_C_AVX512(File Flags...)
  5149. ###
  5150. ### Compile a single C/C++ file with AVX512 and additional Flags
  5151. macro SRC_C_AMX(FILE, FLAGS...) {
  5152. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AMX $FILE .amx $AMX_CFLAGS $FLAGS)
  5153. }
  5154. # tag:src-specific tag:cpp-specific tag:cpu
  5155. ### @uasge SRC_C_XOP(File Flags...)
  5156. ###
  5157. ### Compile a single C/C++ file with (an AMD-specific instruction set,
  5158. ### see https://en.wikipedia.org/wiki/XOP_instruction_set) and additional Flags
  5159. macro SRC_C_XOP(FILE, FLAGS...) {
  5160. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_XOP $FILE .xop $XOP_CFLAGS $FLAGS)
  5161. }
  5162. # tag:src-specific tag:cpp-specific tag:cpu
  5163. ### @uasge SRC_C_PCLMUL(File Flags...)
  5164. ###
  5165. ### Compile a single C/C++ file with PCLMUL and additional Flags
  5166. macro SRC_C_PCLMUL(FILE, FLAGS...) {
  5167. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_PCLMUL $FILE .pclmul $PCLMUL_CFLAGS $FLAGS )
  5168. }
  5169. # tag:src-specific tag:cpp-specific
  5170. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5171. ###
  5172. ### Defenition of generic macro. Report an error that the File with Ext is not
  5173. ### supported by macro MacroName if no appropriate macro specialization is found.
  5174. macro _SRC_STRICT_C_CPP(EXT, MACRO_NAME, FILE, FLAGS...) {
  5175. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  5176. }
  5177. # tag:src-specific tag:cpp-specific
  5178. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5179. ###
  5180. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single C file (with .c extension)
  5181. macro _SRC_STRICT_C_CPP("c", MACRO_NAME, FILE, FLAGS...) {
  5182. _SRC(c $FILE $FLAGS)
  5183. }
  5184. # tag:src-specific tag:cpp-specific
  5185. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5186. ###
  5187. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cpp extension)
  5188. macro _SRC_STRICT_C_CPP("cpp", MACRO_NAME, FILE, FLAGS...) {
  5189. _SRC(cpp $FILE $FLAGS)
  5190. }
  5191. # tag:src-specific tag:cpp-specific
  5192. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5193. ###
  5194. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cxx extension)
  5195. macro _SRC_STRICT_C_CPP("cxx", MACRO_NAME, FILE, FLAGS...) {
  5196. _SRC(cpp $FILE $FLAGS)
  5197. }
  5198. # tag:src-specific tag:cpp-specific
  5199. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5200. ###
  5201. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cc extension)
  5202. macro _SRC_STRICT_C_CPP("cc", MACRO_NAME, FILE, FLAGS...) {
  5203. _SRC(cpp $FILE $FLAGS)
  5204. }
  5205. # tag:src-specific tag:cpp-specific
  5206. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  5207. ###
  5208. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .C extension)
  5209. macro _SRC_STRICT_C_CPP("C", MACRO_NAME, FILE, FLAGS...) {
  5210. _SRC(cpp $FILE $FLAGS)
  5211. }
  5212. # tag:src-specific tag:cpp-specific
  5213. ### @uasge SRC_C_PIC(File Flags...)
  5214. ###
  5215. ### Compile a single C/C++ file with -fPIC and additional Flags
  5216. macro SRC_C_PIC(FILE, FLAGS...) {
  5217. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PIC $FILE $PIC_CFLAGS $FLAGS)
  5218. }
  5219. # tag:src-specific tag:cpp-specific
  5220. ### @uasge SRC_C_NO_LTO(File Flags...)
  5221. ###
  5222. ### Compile a single C/C++ file with link-time-optimization disabling and additional Flags
  5223. macro SRC_C_NO_LTO(FILE, FLAGS...) {
  5224. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_NO_LTO $FILE $NO_LTO_CFLAGS $FLAGS)
  5225. }
  5226. # tag:python-processing tag:cython
  5227. # TODO: use it in [.pyx] cmd
  5228. ### @usage: BUILDWITH_CYTHON_CPP(Src Options...)
  5229. ###
  5230. ### Generates .cpp file from .pyx.
  5231. macro BUILDWITH_CYTHON_CPP(Src, Options...) {
  5232. .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"}
  5233. .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
  5234. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5235. }
  5236. # tag:python-processing tag:cython tag:internal
  5237. ### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal
  5238. ###
  5239. ### Generates .cpp file from .pyx and attach extra input Dep.
  5240. ### If Dep changes the .cpp file will be re-generated.
  5241. macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) {
  5242. .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"}
  5243. .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
  5244. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5245. }
  5246. # tag:python-processing tag:cython tag:internal
  5247. ### @usage: _BUILDWITH_CYTHON_CPP_H(Src Dep Options...) # internal
  5248. ###
  5249. ### BUILDWITH_CYTHON_CPP without .pyx infix and with cdef public .h file.
  5250. macro _BUILDWITH_CYTHON_CPP_H(Src, Dep, Options...) {
  5251. .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"}
  5252. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5253. }
  5254. # tag:python-processing tag:cython
  5255. ### @usage: BUILDWITH_CYTHON_C(Src Options...)
  5256. ###
  5257. ### Generates .c file from .pyx.
  5258. macro BUILDWITH_CYTHON_C(Src, Options...) {
  5259. .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"}
  5260. .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
  5261. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5262. }
  5263. # tag:python-processing tag:cython tag:internal
  5264. ### @usage: _BUILDWITH_CYTHON_C_DEP(Src Dep Options...) # internal
  5265. ###
  5266. ### Generates .c file from .pyx and attach extra input Dep.
  5267. ### If Dep changes the .c file will be re-generated.
  5268. macro _BUILDWITH_CYTHON_C_DEP(Src, Dep, Options...) {
  5269. .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"}
  5270. .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
  5271. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5272. }
  5273. # tag:python-processing tag:cython tag:internal
  5274. ### @usage: _BUILDWITH_CYTHON_C_H(Src Dep Options...) # internal
  5275. ###
  5276. ### BUILDWITH_CYTHON_C without .pyx infix and with cdef public .h file.
  5277. macro _BUILDWITH_CYTHON_C_H(Src, Dep, Options...) {
  5278. .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"}
  5279. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5280. }
  5281. # tag:python-processing tag:cython tag:internal
  5282. ### @usage: _BUILDWITH_CYTHON_C_API_H(Src Dep Options...) # internal
  5283. ###
  5284. ### BUILDWITH_CYTHON_C_H with cdef api _api.h file.
  5285. macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) {
  5286. .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"}
  5287. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  5288. }
  5289. ### @usage: BUILDWITH_RAGEL6(Src Options...)
  5290. ###
  5291. ### Compile .rl file using Ragel6.
  5292. macro BUILDWITH_RAGEL6(Src, Options...) {
  5293. .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"}
  5294. }
  5295. # tag:python-processing tag:internal
  5296. # TODO: use it in [.pyx] cmd
  5297. ### @usage: _PY_REGISTER() # internal
  5298. ###
  5299. ### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive.
  5300. ###
  5301. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5302. macro _PY_REGISTER(Func) {
  5303. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${output;noauto:Func.reg.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5304. SRCS(GLOBAL $Func.reg.cpp)
  5305. }
  5306. # tag:python-processing tag:internal
  5307. ### @usage: _PY3_REGISTER() # internal
  5308. ###
  5309. ### Register Python 3.x module in internal resource file system. Arcadia Python 3.x importer will be retrieve these on import directive
  5310. ###
  5311. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5312. macro _PY3_REGISTER(Func) {
  5313. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py3_reg.py"} $Func ${output;noauto:Func.reg3.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5314. SRCS(GLOBAL $Func.reg3.cpp)
  5315. }
  5316. # tag:python-processing tag:internal
  5317. ### @usage: _PY_COMPILE_BYTECODE(SrcX Src) # internal
  5318. ###
  5319. ### Compile Python 2.x .py source file into Arcadia binary form suitable for PY2_PROGRAM
  5320. ###
  5321. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5322. macro _PY_COMPILE_BYTECODE(SrcX, Src, Dst) {
  5323. .CMD=$YMAKE_PYTHON ${input:"build/scripts/py_compile.py"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5324. }
  5325. # tag:python-processing tag:internal
  5326. ### @usage: _PY3_COMPILE_BYTECODE(SrcX Src) # internal
  5327. ###
  5328. ### Compile Python 3.x .py source file into Arcadia binary form suitable for PY3_PROGRAM
  5329. ###
  5330. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  5331. macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) {
  5332. .CMD=${env:"PYTHONHASHSEED=0"} ${tool:"contrib/tools/python3/pycc"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc3} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  5333. }
  5334. macro _ARCHIVE_SEM_HELPER(FLAGS[], OUT, Files...) {
  5335. .SEM=add_custom_command OUTPUT ${OUT} DEPENDS $ARCH_TOOL ${join= :Files} COMMAND $ARCH_TOOL $FLAGS ${join=\: :Files}: -o ${OUT}
  5336. }
  5337. ### @usage: ARCHIVE_ASM(NAME archive_name files...)
  5338. ###
  5339. ### Similar to the macro ARCHIVE, but:
  5340. ### 1. works faster and it is better to use for large files.
  5341. ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test)
  5342. macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  5343. .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;suf=$OBJ_SUF.rodata:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"}
  5344. .SEM=$_ARCHIVE_SEM_HELPER(${output;suf=$OBJ_SUF.rodata:NAME} ${input:Files} FLAGS -q $DONTCOMPRESS)
  5345. }
  5346. # tag:yweb-specific
  5347. macro PIRE_INLINE_CMD(SRC) {
  5348. .CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${output_include;hide:SRC} ${kv;hide:"p PI"} ${kv;hide:"pc yellow"}
  5349. }
  5350. # tag:yweb-specific
  5351. macro PIRE_INLINE(FILES...) {
  5352. foreach (FILE : $FILES) {
  5353. PIRE_INLINE_CMD($FILE)
  5354. }
  5355. }
  5356. ### @usage: ARCHIVE(archive_name [DONT_COMPRESS] files...)
  5357. ###
  5358. ### Add arbitrary data to a modules. Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  5359. ###
  5360. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  5361. macro ARCHIVE(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  5362. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  5363. .SEM=$_ARCHIVE_SEM_HELPER(${output;addincl;noauto:NAME} ${input:Files} FLAGS -q -x $DONTCOMPRESS) && target_sources PRIVATE $BINDIR/$NAME
  5364. }
  5365. ### @usage: ARCHIVE_BY_KEYS(archive_name key [DONT_COMPRESS] files...)
  5366. ###
  5367. ### Add arbitrary data to a module be accessible by specified key.
  5368. ### Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  5369. ###
  5370. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  5371. macro ARCHIVE_BY_KEYS(NAME="", KEYS="", DONTCOMPRESS?"-p":"", Files...) {
  5372. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input:Files} -k $KEYS -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  5373. }
  5374. #scripts
  5375. #special commands
  5376. BUILDVERSION_SCRIPT=build/scripts/build_info_gen.py
  5377. SVNVERSION_JAVA_MARKER=output-java-class
  5378. SVNVERSION_GO_MARKER=output-go
  5379. VCS_C_OBJ=$BINDIR/__vcs_version__.c$OBJECT_SUF
  5380. VCS_C_OBJ_RR=$MODDIR/__vcs_version__.c$OBJECT_SUF
  5381. VCS_C=$BINDIR/__vcs_version__.c
  5382. VCS_GO=$BINDIR/__vcs_version__.go
  5383. VCS_JAVA=$BINDIR/__vcs_version__.mf
  5384. VCS_INFO_DISABLE_CACHE__NO_UID__=
  5385. YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  5386. CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  5387. CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=
  5388. YASM_DEBUG_INFO=
  5389. CL_DEBUG_INFO=
  5390. CL_MACRO_INFO=
  5391. when ($FORCE_VCS_INFO_UPDATE == "yes") {
  5392. VCS_INFO_DISABLE_CACHE__NO_UID__=${hide;kv:"disable_cache"}
  5393. }
  5394. ### Works for pyton too.
  5395. 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))
  5396. 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__
  5397. 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__
  5398. macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) {
  5399. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__
  5400. }
  5401. VCS_INFO_FILE=
  5402. ### @usage VCS_INFO_FILE([FILE out_file])
  5403. ###
  5404. ### Enable saving vcs info as a json-file into PACKAGE
  5405. ###
  5406. ### Info is saved to 'vcs_info.json' by default.
  5407. ### Use FILE parameter if you want another name.
  5408. ###
  5409. ### Note: macro can be used only once per module
  5410. macro VCS_INFO_FILE(FILE="vcs_info.json") {
  5411. SET(VCS_INFO_FILE $FILE)
  5412. }
  5413. ADD_VCS_INFO_FILE_CMD=
  5414. when ($VCS_INFO_FILE) {
  5415. 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__
  5416. }
  5417. ### @usage: CREATE_BUILDINFO_FOR(GenHdr)
  5418. ###
  5419. ### Creates header file to access some information about build specified via configuration variables.
  5420. ### Unlike CREATE_SVNVERSION_FOR() it doesn't take revion information from VCS, it uses revision and SandboxTaskId passed via -D options to ya make
  5421. macro CREATE_BUILDINFO_FOR(GenHdr) {
  5422. .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__
  5423. .SEM=$RUN_PYTHON3($BUILDVERSION_SCRIPT $GenHdr \\\"${CMAKE_CXX_COMPILER}\\\" \\\"${CMAKE_CXX_FLAGS}\\\" OUT $GenHdr)
  5424. }
  5425. DECIMAL_MD5_SCRIPT=build/scripts/decimal_md5.py
  5426. DECIMAL_MD5_FIXED=
  5427. ### @usage: DECIMAL_MD5_LOWER_32_BITS(<fileName> [FUNCNAME funcName] [inputs...])
  5428. ###
  5429. ### Generates .cpp file <fileName> with one defined function 'const char* <funcName>() { return "<calculated_md5_hash>"; }'.
  5430. ### <calculated_md5_hash> will be md5 hash for all inputs passed to this macro.
  5431. macro DECIMAL_MD5_LOWER_32_BITS(File, FUNCNAME="", Opts...) {
  5432. .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"}
  5433. }
  5434. # tag:internal
  5435. ### @usage $CFG_VARS # internal
  5436. ###
  5437. ### Mark commands that embed Configuration variables into files
  5438. macro CFG_VARS() {
  5439. .GEN_FROM_FILE=yes
  5440. }
  5441. ### @usage: CONFIGURE_FILE(from to)
  5442. ###
  5443. ### Copy file with the replacement of configuration variables in form of @ANY_CONF_VAR@ with their values.
  5444. ### The values are collected during configure stage, while replacement itself happens during build stage.
  5445. ### Used implicitly for .in-files processing.
  5446. macro CONFIGURE_FILE(Src, Dst) {
  5447. .CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${kv;hide:"p CF"} ${kv;hide:"pc yellow"}
  5448. .SEM=set_vars ${CFG_VARS} && configure_file $S/${input;rootrel:Src} $B/${output;addincl;rootrel:Dst}
  5449. }
  5450. ### @usage: BASE_CODEGEN(tool_path prefix)
  5451. ###
  5452. ### Generator ${prefix}.cpp + ${prefix}.h files based on ${prefix}.in.
  5453. macro BASE_CODEGEN(Tool, Prefix, Opts...) {
  5454. .CMD=${tool:Tool} ${input:Prefix.in} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc yellow"}
  5455. }
  5456. # tag:internal
  5457. ### @usage: _SPLIT_CODEGEN_BASE(tool prefix OUTS[] OUTPUT_INCLUDES[]) # internal
  5458. ###
  5459. ### Generator of a certain number .the. cpp file + one header .h file from .in.
  5460. ### This is the call of the generator. Python macro SPLIT_CODEGEN() is defined in order to properly fill command outputs from OUT_NUM argument.
  5461. macro _SPLIT_CODEGEN_BASE(Tool, Prefix, OUT[], OPTS[], OUTPUT_INCLUDES[]) {
  5462. .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"}
  5463. }
  5464. STRUCT_CODEGEN_OUTPUT_INCLUDES=${output_include;hide:"util/generic/singleton.h"} \
  5465. ${output_include;hide:"util/generic/strbuf.h"} \
  5466. ${output_include;hide:"util/generic/vector.h"} \
  5467. ${output_include;hide:"util/generic/ptr.h"} \
  5468. ${output_include;hide:"util/generic/yexception.h"} \
  5469. ${output_include;hide:"kernel/struct_codegen/reflection/reflection.h"} \
  5470. ${output_include;hide:"kernel/struct_codegen/reflection/floats.h"}
  5471. ### @usage: STRUCT_CODEGEN(Prefix)
  5472. ### A special case BASE_CODEGEN, in which the kernel/struct_codegen/codegen_tool tool is used.
  5473. macro STRUCT_CODEGEN(Prefix) {
  5474. .CMD=$BASE_CODEGEN(kernel/struct_codegen/codegen_tool, $Prefix, $STRUCT_CODEGEN_OUTPUT_INCLUDES)
  5475. .PEERDIR=kernel/struct_codegen/metadata kernel/struct_codegen/reflection
  5476. }
  5477. ### @usage: DUMPERF_CODEGEN(Prefix)
  5478. ### A special case BASE_CODEGEN, in which the extsearch/images/robot/tools/dumperf/codegen tool is used
  5479. macro DUMPERF_CODEGEN(Prefix) {
  5480. .CMD=$BASE_CODEGEN(extsearch/images/robot/tools/dumperf/codegen, $Prefix, ${output_include;hide:"extsearch/images/kernel/erf/erf_format.h"})
  5481. }
  5482. # tag:flags
  5483. ### @usage: LDFLAGS(LinkerFlags...)
  5484. ###
  5485. ### Add flags to the link command line of executable or shared library/dll.
  5486. ### Note: LDFLAGS are always global. When set in the LIBRARY module they will affect all programs/dlls/tests the library is linked into.
  5487. ### Note: remember about the incompatibility of flags for gcc and cl.
  5488. macro LDFLAGS(Flags...) {
  5489. SET_APPEND(LDFLAGS_GLOBAL $Flags)
  5490. }
  5491. # tag:flags
  5492. ### @usage: CFLAGS([GLOBAL compiler_flag]* compiler_flags)
  5493. ###
  5494. ### Add the specified flags to the compilation command of C and C++ files.
  5495. ### @params: GLOBAL - Propagates these flags to dependent projects
  5496. ### Note: remember about the incompatibility flags for clang and cl (to set flags specifically for cl.exe use MSVC_FLAGS).
  5497. macro CFLAGS(Flags...) {
  5498. SET_APPEND_WITH_GLOBAL(USER_CFLAGS $Flags)
  5499. }
  5500. # tag:flags
  5501. ### @usage: MASMFLAGS(compiler flags)
  5502. ### Add the specified flags to the compilation command of .masm files.
  5503. macro MASMFLAGS(Flags...) {
  5504. SET_APPEND(MASMFLAGS $Flags)
  5505. }
  5506. # tag:flags
  5507. ### @usage: CONLYFLAGS([GLOBAL compiler_flag]* compiler_flags)
  5508. ### Add the specified flags to the compilation command of .c (but not .cpp) files.
  5509. ### @params: GLOBAL - Distributes these flags on dependent projects
  5510. macro CONLYFLAGS(Flags...) {
  5511. SET_APPEND_WITH_GLOBAL(USER_CONLYFLAGS $Flags)
  5512. }
  5513. # tag:flags
  5514. ### @usage: CXXFLAGS(compiler_flags)
  5515. ### Add the specified flags to the compilation command of .cpp (but not .c) files.
  5516. macro CXXFLAGS(Flags...) {
  5517. SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags)
  5518. }
  5519. # tag:flags
  5520. ### @usage: CUDA_NVCC_FLAGS(compiler flags)
  5521. ### Add the specified flags to the compile line .cu-files.
  5522. macro CUDA_NVCC_FLAGS(Flags...) {
  5523. SET_APPEND(CUDA_NVCC_FLAGS $Flags)
  5524. }
  5525. # tag:flags
  5526. ### @usage: NVCC_DEVICE_LINK(file.cu...)
  5527. ### Run nvcc --device-link on objects compiled from srcs with --device-c.
  5528. ### This generates a stub object devlink.o that supplies missing pieces for the
  5529. ### host linker to link relocatable device objects into the final executable.
  5530. macro NVCC_DEVICE_LINK(Srcs...) {
  5531. .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"}
  5532. }
  5533. # tag:flags
  5534. ### @usage: CYTHON_FLAGS(compiler_flags)
  5535. ### Add the specified flags to the compilation command of .pyx files.
  5536. macro CYTHON_FLAGS(Flags...) {
  5537. SET_APPEND(CYTHON_OPTIONS $Flags)
  5538. }
  5539. ### @usage: STRIP()
  5540. ### Strip debug info from a PROGRAM, DLL or TEST.
  5541. ### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's.
  5542. macro STRIP() {
  5543. ENABLE(STRIP)
  5544. }
  5545. ### @usage: NO_OPTIMIZE()
  5546. ### Build code without any optimizations (-O0 mode).
  5547. macro NO_OPTIMIZE() {
  5548. ENABLE(NO_OPTIMIZE)
  5549. }
  5550. #TODO(YMAKE-91) read proper compile flags instead of sending explicit flags to semgraph directly
  5551. _SEM_EXTRA_CXX_FLAGS=
  5552. ### @usage: NO_COMPILER_WARNINGS()
  5553. ### Disable all compiler warnings in the module.
  5554. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5555. macro NO_COMPILER_WARNINGS() {
  5556. ENABLE(NO_COMPILER_WARNINGS)
  5557. SET(_SEM_EXTRA_CXX_FLAGS "$<IF:$<CXX_COMPILER_ID:MSVC>,,-Wno-everything>")
  5558. }
  5559. ### @usage: WERROR()
  5560. ### Consider warnings as errors in the current module.
  5561. ### In the bright future will be removed, since WERROR is the default.
  5562. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5563. macro WERROR() {
  5564. ENABLE(WERROR)
  5565. }
  5566. ### @usage: NO_WERROR()
  5567. ### Override WERROR() behavior
  5568. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  5569. macro NO_WERROR() {
  5570. DISABLE(WERROR)
  5571. }
  5572. ### @usage: NO_WSHADOW()
  5573. ### Disable C++ shadowing warnings.
  5574. macro NO_WSHADOW() {
  5575. ENABLE(NO_WSHADOW)
  5576. }
  5577. # tag:internal
  5578. ### @usage: NO_PLATFORM_RESOURCES() # internal
  5579. ### Exclude dependency on platform resources libraries.
  5580. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  5581. macro NO_PLATFORM_RESOURCES() {
  5582. ENABLE(NOPLATFORM_RESOURCES)
  5583. }
  5584. # tag:internal tag:codenav
  5585. ### @usage: NO_CODENAVIGATION() # internal
  5586. ### Disable codenaviagtion for a module. Needed to avoid PEERDIR loops in codenavigation support.
  5587. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  5588. macro NO_CODENAVIGATION() {
  5589. ENABLE(NOCODENAVIGATION)
  5590. }
  5591. ### @usage: NO_UTIL()
  5592. ### Build module without dependency on util.
  5593. ### Note: use this with care. Util most likely will be linked into executable anyway,
  5594. ### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time.
  5595. macro NO_UTIL() {
  5596. ENABLE(NOUTIL)
  5597. }
  5598. ### @usage: NO_RUNTIME()
  5599. ###
  5600. ### This macro:
  5601. ### 1. Sets the ENABLE(NOUTIL) + DISABLE(USE_INTERNAL_STL);
  5602. ### 2. If the project that contains the macro NO_RUNTIME(), peerdir-it project does not contain NO_RUNTIME() => Warning.
  5603. ### Note: use this with care. Arcadia STL most likely will be linked into executable anyway, so using STL headers/functions/classes
  5604. ### may not be detected at build time and may lead to unpredictable behavors at configure time.
  5605. macro NO_RUNTIME() {
  5606. SET(USE_ARCADIA_LIBM no)
  5607. NO_UTIL()
  5608. ENABLE(NORUNTIME)
  5609. }
  5610. ### @usage: NO_LIBC()
  5611. ###
  5612. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata).
  5613. ### Note: use this with care. libc most likely will be linked into executable anyway,
  5614. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  5615. macro NO_LIBC() {
  5616. NO_RUNTIME()
  5617. DISABLE(MUSL)
  5618. }
  5619. ### @usage: NO_PLATFORM()
  5620. ###
  5621. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing.
  5622. ### Note: use this with care. libc most likely will be linked into executable anyway,
  5623. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  5624. macro NO_PLATFORM() {
  5625. NO_LIBC()
  5626. ENABLE(NOPLATFORM)
  5627. }
  5628. # tag:cpp-specific
  5629. ### @usage: USE_CXX()
  5630. ###
  5631. ### Add dependency on C++ runtime
  5632. ### Note: This macro is inteneded for use in _GO_BASE_UNIT like module when the module is built without C++ runtime by default
  5633. macro USE_CXX() {
  5634. DISABLE(NORUNTIME)
  5635. }
  5636. ### @usage: USE_UTIL()
  5637. ###
  5638. ### Add dependency on util and C++ runtime
  5639. ### Note: This macro is intended for use in _GO_BASE_UNIT like module when the module is build without util by default
  5640. macro USE_UTIL() {
  5641. USE_CXX()
  5642. DISABLE(NOUTIL)
  5643. }
  5644. ### @usage: USE_NASM()
  5645. ###
  5646. ### Build only .asm files with nasm toolchain instead of yasm
  5647. ### Add to ya.make file ADDINCL(asm ...) with all folders where .asm files include smth
  5648. macro USE_NASM() {
  5649. ENABLE(USE_NASM_ASSEMBLER)
  5650. PEERDIR(build/external_resources/nasm)
  5651. }
  5652. # tag:deprecated
  5653. ### @usage: NO_JOIN_SRC() # deprecated, does-nothing
  5654. ### This macro currently does nothing. This is default behavior which cannot be overridden at module level.
  5655. macro NO_JOIN_SRC() {
  5656. ENABLE(UNUSED_MACRO)
  5657. }
  5658. # tag:sanitize
  5659. ### @usage: NO_SANITIZE()
  5660. ###
  5661. ### Disable all sanitizers for the module.
  5662. macro NO_SANITIZE() {
  5663. DISABLE(SANITIZER_TYPE)
  5664. }
  5665. # tag:coverage tag:sanitize
  5666. ### @usage: NO_SANITIZE_COVERAGE()
  5667. ###
  5668. ### Disable lightweight coverage (-fsanitize-coverage) for the module.
  5669. ### Sanitize coverage is commonly used with fuzzing.
  5670. ### It might be useful to disable it for libraries that should never
  5671. ### be the main targets for fuzzing, like libfuzzer library itself.
  5672. ### Sanitize coverage instrumentation is enabled by the --sanitize-coverage option.
  5673. macro NO_SANITIZE_COVERAGE() {
  5674. DISABLE(SANITIZE_COVERAGE)
  5675. }
  5676. # tag:coverage
  5677. ### @usage: NO_CLANG_COVERAGE()
  5678. ###
  5679. ### Disable heavyweight clang coverage for the module. Clang coverage instrumentation is enabled by the --clang-coverage option.
  5680. macro NO_CLANG_COVERAGE() {
  5681. DISABLE(CLANG_COVERAGE)
  5682. }
  5683. macro NO_CLANG_TIDY() {
  5684. DISABLE(TIDY_ENABLED)
  5685. }
  5686. # tag:python-specific tag:coverage
  5687. ### @usage: NO_PYTHON_COVERAGE()
  5688. ###
  5689. ### Disable python coverage for module
  5690. macro NO_PYTHON_COVERAGE() {
  5691. DISABLE(PYTHON_COVERAGE)
  5692. }
  5693. # tag:python-specific tag:coverage tag:cython
  5694. ### @usage: NO_CYTHON_COVERAGE()
  5695. ###
  5696. ### Disable cython and cythonized python coverage (CYTHONIZE_PY)
  5697. ### Implies NO_CLANG_COVERAGE() - right now, we can't disable instrumentation for .py.cpp files, but enable for .cpp
  5698. macro NO_CYTHON_COVERAGE() {
  5699. DISABLE(CYTHON_COVERAGE)
  5700. NO_CLANG_COVERAGE()
  5701. }
  5702. # tag:lua-specific
  5703. LUAJIT_PATH=${ARCADIA_ROOT}/contrib/libs/luajit
  5704. macro _LUAJIT_OBJDUMP(Src, OUT="") {
  5705. .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"}
  5706. }
  5707. # tag:lua-specific
  5708. LUAJIT_21_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_21
  5709. macro _LUAJIT_21_OBJDUMP(Src, OUT="") {
  5710. .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"}
  5711. }
  5712. macro _MX_BIN_TO_INFO(Src) {
  5713. .CMD=${tool:"tools/mx_bin2info"} ${input:Src} ${output;nopath;noext;noauto:Src.info} ${kv;hide:"p MX"} ${kv;hide:"pc yellow"}
  5714. }
  5715. MX_GEN_TABLE_INCLS=${output_include;hide:"yabs_mx_calc_table.h"} \
  5716. ${output_include;hide:"kernel/matrixnet/mn_sse.h"} \
  5717. ${output_include;hide:"library/cpp/archive/yarchive.h"} \
  5718. ${output_include;hide:"util/memory/blob.h"} \
  5719. ${output_include;hide:"util/generic/hash.h"} \
  5720. ${output_include;hide:"util/generic/ptr.h"} \
  5721. ${output_include;hide:"util/generic/singleton.h"}
  5722. macro _MX_GEN_TABLE(Srcs...) {
  5723. .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"}
  5724. PEERDIR(kernel/matrixnet)
  5725. PEERDIR(library/cpp/archive)
  5726. }
  5727. RELEV_FML_CODEGEN_INCLS=${output_include;hide:"kernel/relevfml/relev_fml.h"} ${output_include;hide:"library/cpp/sse/sse.h"}
  5728. ### @usage: GENERATE_ENUM_SERIALIZATION(File.h)
  5729. ###
  5730. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module.
  5731. ###
  5732. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  5733. macro GENERATE_ENUM_SERIALIZATION(File) {
  5734. .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"}
  5735. .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser"}
  5736. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  5737. }
  5738. ### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h)
  5739. ###
  5740. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module
  5741. ### Provide access to serialization functions via generated header File_serialized.h
  5742. ###
  5743. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  5744. macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) {
  5745. .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"}
  5746. .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"}
  5747. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  5748. }
  5749. ### @usage: DEB_VERSION(File)
  5750. ###
  5751. ### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File.
  5752. macro DEB_VERSION(File) {
  5753. .CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${output;stdout:"DebianVersion.h"} ${kv;hide:"p CL"} ${kv;hide:"pc yellow"}
  5754. }
  5755. BUILD_MN_SCRIPT=build/scripts/build_mn.py
  5756. # tag:matrixnet
  5757. ### @usage: BUILD_MN([CHECK] [PTR] [MULTI] mninfo mnname) # matrixnet
  5758. ###
  5759. ### Generate MatrixNet data and access code using single command.
  5760. ### Alternative macro BUILD_MNS() works faster and better for large files.
  5761. macro BUILD_MN(MnInfo, MnName, CHECK?"fml_tool=$FML_UNUSED_TOOL CHECK":"", MULTI?, PTR?, RANKING_SUFFIX="") {
  5762. .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"}
  5763. }
  5764. macro _BUILD_MNS_FILE(Input, Name, Output, Suffix, Check, Fml_tool, AsmDataName) {
  5765. .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"}
  5766. }
  5767. MNS_OUTPUT=mnmodels
  5768. macro _BUILD_MNS_CPP(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  5769. .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"}
  5770. }
  5771. macro _BUILD_MNS_HEADER(NAME="", CHECK?, RANKING_SUFFIX="", Files...) {
  5772. .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"}
  5773. }
  5774. # TODO: support foreach_in and keywords simultaneous usage (look at BUILD_MNS_FILES)
  5775. # tag:matrixnet
  5776. ### @usage: BUILD_MNS([CHECK] NAME listname mninfos...) # matrixnet
  5777. ###
  5778. ### Generate MatrixNet data and access code using separate commands for support code, interface and data.
  5779. ### Faster version of BUILD_MN() macro for large files.
  5780. macro BUILD_MNS(Files...) {
  5781. _BUILD_MNS_HEADER($Files)
  5782. _BUILD_MNS_CPP($Files)
  5783. _BUILD_MNS_FILES($Files)
  5784. }
  5785. ### @usage: COMPILE_NLG(nlg_config.json, [TRANSLATIONS_JSON translations.json], Src...)
  5786. ###
  5787. ### Generate and compile .nlg templates (Jinja2-based) and interface for megamind runtime in localized mode.
  5788. ###
  5789. ### Alice-specific macro
  5790. macro COMPILE_NLG(NLG_CONFIG_JSON, TRANSLATIONS_JSON="", Src...) {
  5791. when ($TRANSLATIONS_JSON) {
  5792. TRANSLATIONS_JSON_ARG=--translations-json
  5793. }
  5794. otherwise {
  5795. TRANSLATIONS_JSON_ARG=
  5796. }
  5797. PEERDIR(alice/nlg/library/nlg_project_runtime)
  5798. 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})
  5799. SRCS(GLOBAL register.cpp nlg_renderer_factory.cpp translations.cpp ${suf=.cpp:Src})
  5800. }
  5801. ### @usage: NEED_CHECK()
  5802. ###
  5803. ### Commits to the project marked with this macro will be blocked by pre-commit check and then will be
  5804. ### automatically merged to trunk only if there is no new broken build targets in check results.
  5805. ### The use of this macro is disabled by default.
  5806. macro NEED_CHECK(Flags...) {
  5807. # TODO: FIXME
  5808. ENABLE(UNUSED_MACRO)
  5809. }
  5810. ### @usage: NO_NEED_CHECK()
  5811. ###
  5812. ### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro.
  5813. macro NO_NEED_CHECK(Flags...) {
  5814. ENABLE(UNUSED_MACRO)
  5815. }
  5816. # tag:deprecated
  5817. ### @usage: NEED_REVIEW() # deprecated
  5818. ###
  5819. ### Mark the project as needing review.
  5820. ### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default.
  5821. ### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104
  5822. macro NEED_REVIEW(Flags...) {
  5823. # TODO: FIXME
  5824. ENABLE(UNUSED_MACRO)
  5825. }
  5826. ### @usage: VERSION(Args...)
  5827. ###
  5828. ### Specify version of a module. Currently unused by build system, only informative.
  5829. macro VERSION(Flags...) {
  5830. ENABLE(UNUSED_MACRO)
  5831. }
  5832. DATAWORK_SCHEEME_EXPORT_FLAGS=
  5833. when ($UNIX == "yes") {
  5834. SCHEEME2_CFLAGS= -E -x c++
  5835. }
  5836. when ($WIN32 == "yes") {
  5837. SCHEEME2_CFLAGS= /E /TP
  5838. }
  5839. SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc44_no_typename --no_complex_overloaded_func_export
  5840. ### @usage: GEN_SCHEEME2(scheeme_name from_file dependent_files...)
  5841. ###
  5842. ### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected).
  5843. ###
  5844. ### 1. ${scheeme_name}.inc - the name of the generated file.
  5845. ### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser
  5846. ###
  5847. ### @example:
  5848. ###
  5849. ### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::")
  5850. ###
  5851. ### 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)
  5852. ### sets in extra option
  5853. ###
  5854. ### @example:
  5855. ###
  5856. ### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
  5857. ### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
  5858. ### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
  5859. ###
  5860. ### for compatibility with C++ compiler and the external environment.
  5861. ### See tools/structparser for more details.
  5862. macro GEN_SCHEEME2(ScheemeName, FromFile) {
  5863. .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"}
  5864. }
  5865. ### @usage: SYMLINK(from to)
  5866. ### Add symlink
  5867. macro SYMLINK(From, To) {
  5868. .CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${output;noauto:To} ${kv;hide:"p LN"} ${kv;hide:"pc light-cyan"}
  5869. }
  5870. # tag:internal
  5871. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  5872. ### Generate prefix " && target_sources PRIVATE " before $Args when GENERATE is specified in the list of actual arguments
  5873. macro _TARGET_SOURCES_FOR_HEADERS_IMPL(GENERATE?" && target_sources PRIVATE ":"", Args...) {
  5874. .SEM=$GENERATE ${output;ext=.h:Args} ${output;ext=.hh:Args} ${output;ext=.hpp:Args} ${output;ext=.inc:Args} ${output;ext=.i:Args}
  5875. }
  5876. # tag:internal
  5877. ### @usage: _TARGET_SOURCES_FOR_HEADERS(Args...) # internal
  5878. ### Generate prefix " && target_sources PRIVATE " before $Args if Args is not empty
  5879. macro _TARGET_SOURCES_FOR_HEADERS(Args...) {
  5880. .SEM=$_TARGET_SOURCES_FOR_HEADERS_IMPL(${pre=GENERATE :Args})
  5881. }
  5882. # tag:internal
  5883. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  5884. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args when GENERATE is specified in the list of actual arguments
  5885. macro _SET_ENV_FOR_CUSTOM_COMMAND_IMPL(GENERATE?" ${CMAKE_COMMAND} -E env ":"", Args...) {
  5886. .SEM=$GENERATE ${pre= :Args}
  5887. }
  5888. # tag:internal
  5889. ### @usage: _SET_ENV_FOR_CUSTOM_COMMAND(Args...) # internal
  5890. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args if Args is not empty
  5891. macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
  5892. .SEM=$_SET_ENV_FOR_CUSTOM_COMMAND_IMPL(${pre=GENERATE :Args})
  5893. }
  5894. macro _FMT_INDUCED_DEPS(For, Deps...) {
  5895. .CMD=${induced_deps=$For;hide:Deps}
  5896. }
  5897. ### @usage: PREPARE_INDUCED_DEPS(VAR Type Files...)
  5898. ###
  5899. ### Format value for `INDUCED_DEPS` param in certain macros and assign to `VAR`
  5900. ### This tells that files of Type resulted from code generation macros (not neccessarily directly,
  5901. ### but in processing chain of generated files) should have extra dependencies from list of Files...
  5902. ###
  5903. ### Prominent example here is Cython: one can generate .pyx file that may depend on .pxd and have cimpot from
  5904. ### certain .h. The former is dependency for .pyx itself, while the latter is dependency for .pyx.cpp
  5905. ### resulted from Cython-processing of generated pyx. The code ganeration will look like:
  5906. ### ```
  5907. ### PREPARE_INDUCED_DEPS(PYX_DEPS pyx imported.pxd)
  5908. ### PREPARE_INDUCED_DEPS(CPP_DEPS cpp cdefed.h)
  5909. ### RUN_PYTHON3(generate_pyx.py genereted.pyx OUT generated.pyx INDUCED_DEPS $PYX_DEPS $CPP_DEPS)
  5910. ### ```
  5911. ###
  5912. ### The VAR will basically contain pair of `Type:[Files...]` in a form suitable for passing
  5913. ### as an element of array parameter. This is needed because language of ya.make doesn't support
  5914. ### Dict params right now and so it is impossible to directly pass something
  5915. ### like `{Type1:[Files2...], Type2:[Files2...]}`
  5916. ###
  5917. macro PREPARE_INDUCED_DEPS(VAR, For, Deps...) {
  5918. SET($VAR \$_FMT_INDUCED_DEPS($For $Deps))
  5919. }
  5920. ### @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...])
  5921. ###
  5922. ### Run a program from arcadia.
  5923. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  5924. ###
  5925. ### Parameters:
  5926. ### - tool_path - Path to the directory of the tool.
  5927. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  5928. ### - CWD dir - Absolute path of the working directory.
  5929. ### - ENV key=value... - Environment variables.
  5930. ### - TOOL tools... - Auxiliary tool directories.
  5931. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  5932. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  5933. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  5934. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  5935. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  5936. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  5937. ###
  5938. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  5939. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  5940. ### 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).
  5941. 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...) {
  5942. .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"}
  5943. .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)
  5944. }
  5945. # tag:lua-specific
  5946. ### @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...])
  5947. ###
  5948. ### Run a lua script.
  5949. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  5950. ###
  5951. ### Parameters:
  5952. ### - script_path - Path to the script.3
  5953. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  5954. ### - CWD dir - Absolute path of the working directory.
  5955. ### - ENV key=value... - Environment variables.
  5956. ### - TOOL tools... - Auxiliary tool directories.
  5957. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  5958. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  5959. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  5960. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  5961. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  5962. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  5963. ###
  5964. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  5965. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  5966. 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...) {
  5967. .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"}
  5968. }
  5969. # tag:python-specific
  5970. ### @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...])
  5971. ###
  5972. ### Run a python script with $(PYTHON)/python built from devtools/huge_python.
  5973. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  5974. ###
  5975. ### Parameters:
  5976. ### - script_path - Path to the script.
  5977. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  5978. ### - CWD dir - Absolute path of the working directory.
  5979. ### - ENV key=value... - Environment variables.
  5980. ### - TOOL tools... - Auxiliary tool directories.
  5981. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  5982. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  5983. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  5984. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  5985. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  5986. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  5987. ###
  5988. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  5989. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  5990. 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...) {
  5991. .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"}
  5992. .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)
  5993. }
  5994. # tag:python-specific
  5995. ### @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...])
  5996. ###
  5997. ### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3.
  5998. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  5999. ###
  6000. ### Parameters:
  6001. ### - script_path - Path to the script.
  6002. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  6003. ### - CWD dir - Absolute path of the working directory.
  6004. ### - ENV key=value... - Environment variables.
  6005. ### - TOOL tools... - Auxiliary tool directories.
  6006. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  6007. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  6008. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  6009. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6010. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6011. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6012. ###
  6013. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  6014. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  6015. 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...) {
  6016. .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"}
  6017. .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)
  6018. }
  6019. # tag:java-specific
  6020. 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...) {
  6021. PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6022. .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"}
  6023. }
  6024. ### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6025. ###
  6026. ### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable.
  6027. ### 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.
  6028. ### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT.
  6029. ###
  6030. ### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system.
  6031. ###
  6032. ### RENAME renames files to the corresponding OUT and OUT_NOAUTO outputs:
  6033. ### FROM_SANDBOX(resource_id RENAME in_file1 in_file2 OUT out_file1 out_file2 out_file3)
  6034. ### FROM_SANDBOX(resource_id RENAME in_file1 OUT out_file1 RENAME in_file2 OUT out_file2)
  6035. ### FROM_SANDBOX(FILE resource_id RENAME resource_file OUT out_name)
  6036. ###
  6037. ### RENAME RESOURCE allows to rename the resource without specifying its file name.
  6038. ###
  6039. ### OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  6040. ### INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  6041. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  6042. ###
  6043. ### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and
  6044. ### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position,
  6045. ### so you shall place it immediately after resource_id.
  6046. 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:") {
  6047. .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"}
  6048. ADD_CHECK(check.resource $Id)
  6049. }
  6050. ### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6051. ###
  6052. ### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6053. macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6054. .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"}
  6055. ADD_CHECK(check.mds $Key)
  6056. }
  6057. # tag:internal
  6058. ### @usage: _FROM_EXTERNAL(ExtFile [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE]) #internal
  6059. ###
  6060. ### Use resource described as .external file as [FROM_SANDBOX()](#macro_FROM_SANDBOX)/[FROM_MDS()](#macro_FROM_MDS).
  6061. macro _FROM_EXTERNAL(File, OutFile, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXT="ext:") {
  6062. .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"}
  6063. #FIXME: add '${resource;pre=$EXT:OutFile}' when support of the scheme is added to executors
  6064. #FIXME: add 'ADD_CHECK(check.external $File)' when proper testing is implemented
  6065. }
  6066. ### @usage LARGE_FILES([AUTOUPDATED] Files...)
  6067. ###
  6068. ### Use large file ether from working copy or from remote storage via placeholder <File>.external
  6069. ### If <File> is present locally (and not a symlink!) it will be copied to build directory.
  6070. ### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
  6071. macro LARGE_FILES(AUTOUPDATED?, Files...) {
  6072. # This is needed to correctly switch between remote and local modes
  6073. _GLOB($LF $Files)
  6074. }
  6075. ### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  6076. ###
  6077. ### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  6078. macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  6079. .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"}
  6080. }
  6081. when ($MSVC == "yes") {
  6082. C_AS_CXX_FLAGS=/TP /std:c++17
  6083. }
  6084. otherwise {
  6085. C_AS_CXX_FLAGS=-x c++ -std=c++17
  6086. }
  6087. # tag:cpp-specific
  6088. ### @usage: COMPILE_C_AS_CXX()
  6089. ###
  6090. ### Compile .c files as .cpp ones within a module.
  6091. macro COMPILE_C_AS_CXX() {
  6092. SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS)
  6093. }
  6094. ### @usage: NO_DEBUG_INFO()
  6095. ###
  6096. ### Compile files without debug info collection.
  6097. macro NO_DEBUG_INFO() {
  6098. SET(NO_DEBUGINFO yes)
  6099. }
  6100. ### @usage: CTEMPLATE_VARNAMES(File)
  6101. ###
  6102. ### Generate File.varnames.h using contrib/libs/ctemplate/make_tpl_varnames_h
  6103. ###
  6104. ### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md
  6105. macro CTEMPLATE_VARNAMES(File) {
  6106. .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${output;addincl;nopath;noallext:File.varnames.h} ${input:File}
  6107. }
  6108. LLVM_OPTS=
  6109. CLANG_BC_ROOT=${CLANG11_RESOURCE_GLOBAL}
  6110. macro USE_LLVM_BC12() {
  6111. SET(CLANG_BC_ROOT ${CLANG12_RESOURCE_GLOBAL})
  6112. }
  6113. CLANG_DEFAULT_ROOT=${CLANG_RESOURCE_GLOBAL}
  6114. CLANG_C_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang
  6115. CLANG_CPP_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang++
  6116. CLANG_EMIT_EXTRA_OPTS=
  6117. when ($OS_WINDOWS == "yes") {
  6118. # we can't use c++latest for clang14 now
  6119. # so we set c++20 for it
  6120. # for clang11 (actual clang for CLANG_EMIT_AST_CXX and LLVM_COMPILE_* macroses) /std:c++20 provokes "unused-command-line-argument" error
  6121. # !do not forget to change this flag when updating build/platform/clang
  6122. CLANG_EMIT_EXTRA_OPTS+=/std:c++latest
  6123. }
  6124. when ($OS_ANDROID == "yes") {
  6125. # We use clang shipped with android-ndk which has different layout
  6126. CLANG_DEFAULT_ROOT=$CLANG_ANDROID_RESOURCE_GLOBAL
  6127. when ($HOST_OS_DARWIN) {
  6128. CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
  6129. CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
  6130. }
  6131. otherwise {
  6132. CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
  6133. CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
  6134. }
  6135. }
  6136. ### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...)
  6137. ###
  6138. ### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not.
  6139. ### Note: Output name is used as is, no extension added.
  6140. macro CLANG_EMIT_AST_CXX(Input, Output, Opts...) {
  6141. .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"}
  6142. PEERDIR(build/platform/clang)
  6143. }
  6144. ### @usage: LLVM_COMPILE_CXX(Input Output Opts...)
  6145. ###
  6146. ### Emit LLVM bytecode from .cpp file. BC_CXXFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6147. ### Note: Output name is used as is, no extension added.
  6148. macro LLVM_COMPILE_CXX(Input, Output, Opts...) {
  6149. .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"}
  6150. .SEM=llvm_compile_cxx ${input:Input} ${output;noauto:Output} ${"${CLANGPLUSPLUS}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  6151. PEERDIR(build/platform/clang)
  6152. }
  6153. ### @usage: LLVM_COMPILE_C(Input Output Opts...)
  6154. ###
  6155. ### Emit LLVM bytecode from .c file. BC_CFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  6156. ### Note: Output name is used as is, no extension added.
  6157. macro LLVM_COMPILE_C(Input, Output, Opts...) {
  6158. .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"}
  6159. .SEM=llvm_compile_c ${input:Input} ${output;noauto:Output} ${"${CLANGC}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  6160. PEERDIR(build/platform/clang)
  6161. }
  6162. ### @usage: BPF(Input Output Opts...)
  6163. ###
  6164. ### Emit eBPF bytecode from .c file.
  6165. ### Note: Output name is used as is, no extension added.
  6166. macro BPF(Input, Output, Opts...) {
  6167. .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"}
  6168. PEERDIR(build/platform/clang)
  6169. }
  6170. LD_BINARY_NAME=ld
  6171. when($OS_LINUX) {
  6172. LD_BINARY_NAME=ld.lld
  6173. }
  6174. ### @usage: BPF_STATIC(Input Output Opts...)
  6175. ###
  6176. ### Emit eBPF bytecode from .c file.
  6177. ### Note: Output name is used as is, no extension added.
  6178. macro BPF_STATIC(Input, Output, Opts...) {
  6179. .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}
  6180. PEERDIR(build/platform/clang build/platform/lld)
  6181. }
  6182. ### @usage: LLVM_COMPILE_LL(Input Output Opts...)
  6183. ###
  6184. ### Compile LLVM bytecode to object representation.
  6185. ### Note: Output name is used as is, no extension added.
  6186. macro LLVM_COMPILE_LL(Input, Output, Opts...) {
  6187. .CMD=${CLANG_BC_ROOT}/bin/llvm-as ${input:Input} -o ${output;noauto:Output} ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  6188. PEERDIR(build/platform/clang)
  6189. }
  6190. ### @usage: LLVM_LINK(Output Inputs...)
  6191. ###
  6192. ### Call llvm-link on set of Inputs to produce Output.
  6193. ### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
  6194. macro LLVM_LINK(Output, Inputs...) {
  6195. .CMD=${CLANG_BC_ROOT}/bin/llvm-link ${input:Inputs} -o ${output;noauto:Output} ${kv;hide:"p LD"} ${kv;hide:"pc light-red"}
  6196. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Inputs} COMMAND ${LLVMLINK} ${input:Inputs} -o ${output;noauto:Output}
  6197. PEERDIR(build/platform/clang)
  6198. }
  6199. ### @usage: LLVM_OPT(Input Output Opts...)
  6200. ###
  6201. ### Call llvm-opt with set of Opts on Input to produce Output.
  6202. ### Note: Output name is used as is, no extension added.
  6203. macro LLVM_OPT(Input, Output, Opts...) {
  6204. .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"}
  6205. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMOPT} ${input:Input} -o ${output;noauto:Output} $Opts
  6206. PEERDIR(build/platform/clang)
  6207. }
  6208. ### @usage: LLVM_LLC(Src Opts...)
  6209. ###
  6210. ### Call llvm-llc with set of Opts on Src to produce object file.
  6211. ###
  6212. ### Note: Output name is calculated as concatenation of Src name and platform specific object file extension.
  6213. macro LLVM_LLC(Src, Opts...) {
  6214. .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"}
  6215. .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
  6216. PEERDIR(build/platform/clang)
  6217. }
  6218. when ($NO_DEBUGINFO == "yes") {
  6219. DEBUG_INFO_FLAGS=
  6220. }
  6221. when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") {
  6222. DEBUG_INFO_FLAGS=-gline-tables-only
  6223. }
  6224. # TODO: configurable tar and touch
  6225. PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  6226. # tag:internal
  6227. ### @usage TOUCH(Outputs...) # internal
  6228. ### Just introduce outputs
  6229. macro TOUCH(Outputs...) {
  6230. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
  6231. }
  6232. TOUCH_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"p UN"} ${kv;hide:"pc light-cyan"} $TARGET
  6233. FAKE_PACKAGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"pc light-red"} $TARGET
  6234. 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"}
  6235. TOUCH_PACKAGE=$FAKE_PACKAGE_CMD $VCS_INFO_DISABLE_CACHE__NO_UID__ && $COPY_PACKAGE_CMD
  6236. _P_PK=${kv;hide:"p PK"}
  6237. TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK && $ADD_VCS_INFO_FILE_CMD
  6238. # Note: we don't use touch.py in the command below to avoid introduction of undesired input
  6239. 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__
  6240. UNION_CMD_MF=$UNION_CMD && $GENERATE_MF
  6241. macro _EXPAND_INS_OUTS(FILES{input}[]) {
  6242. .CMD=${input;hide:FILES} ${late_out;hide:INPUT}
  6243. }
  6244. _UNION_EXPLICIT_OUTPUTS=
  6245. ### @usage: EXPLICIT_OUTPUTS(Files...)
  6246. ###
  6247. ### Let UNION has only explicitly specified outputs listed in this macro
  6248. ### The list of files shall contain results of commands in this UNION.
  6249. ### Only these files will be outputs of the UNION. This allows to eliminate
  6250. ### intermediate files being result of the UNION
  6251. macro EXPLICIT_OUTPUTS(Files...) {
  6252. SET_APPEND(_UNION_EXPLICIT_OUTPUTS ${Files})
  6253. }
  6254. NO_CHECK_IMPORTS_FOR_VALUE=None
  6255. ### @usage: NO_CHECK_IMPORTS([patterns])
  6256. ###
  6257. ### Do not run checks on imports of Python modules.
  6258. ### Optional parameter mask patterns describes the names of the modules that do not need to check.
  6259. macro NO_CHECK_IMPORTS(Masks...) {
  6260. SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks)
  6261. }
  6262. # tag:yasm-specific
  6263. _YASM_FMT_VALUE=
  6264. _YASM_PLATFORM_FLAGS_VALUE=
  6265. _YASM_PREDEFINED_FLAGS_VALUE=
  6266. when ($OS_DARWIN || $OS_IOS) {
  6267. _YASM_FMT_VALUE=macho
  6268. _YASM_PLATFORM_FLAGS_VALUE=-D DARWIN -D UNIX
  6269. }
  6270. elsewhen ($OS_WINDOWS && $ARCH_X86_64) {
  6271. _YASM_FMT_VALUE=win
  6272. _YASM_PLATFORM_FLAGS_VALUE=-D WIN64
  6273. }
  6274. elsewhen ($OS_WINDOWS && $ARCH_I386) {
  6275. _YASM_FMT_VALUE=win
  6276. _YASM_PLATFORM_FLAGS_VALUE=-D WIN32
  6277. }
  6278. otherwise {
  6279. _YASM_FMT_VALUE=elf
  6280. _YASM_PLATFORM_FLAGS_VALUE=-D UNIX
  6281. _YASM_PREDEFINED_FLAGS_VALUE=-g dwarf2
  6282. }
  6283. when ($ASM_PREFIX) {
  6284. ASM_PREFIX_VALUE=--prefix=$ASM_PREFIX
  6285. }
  6286. otherwise {
  6287. ASM_PREFIX_VALUE=
  6288. }
  6289. # tag:yasm-specific
  6290. YASM_FLAGS=
  6291. YASM_PREINCLUDES_VALUE=
  6292. # tag:yasm-specific
  6293. macro _SRC_yasm_helper(SRC, PREINCLUDES[], SRCFLAGS...) {
  6294. .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"}
  6295. }
  6296. # tag:yasm-specific
  6297. macro _SRC_yasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  6298. .CMD=$_SRC_yasm_helper(${input:SRC}, $SRCFLAGS, PREINCLUDES $PREINCLUDES)
  6299. }
  6300. # tag:nasm-specific
  6301. NASM_FLAGS=
  6302. # tag:nasm-specific
  6303. macro _SRC_nasm_helper(SRC, SRCFLAGS...) {
  6304. .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}
  6305. }
  6306. # tag:nasm-specific
  6307. macro _SRC_nasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  6308. .CMD=$_SRC_nasm_helper(${input:SRC}, $SRCFLAGS)
  6309. }
  6310. # tag:src-processing
  6311. when ($USE_NASM_ASSEMBLER == "yes") {
  6312. MACRO_ALIAS(_SRC_ASM _SRC_nasm)
  6313. }
  6314. otherwise {
  6315. MACRO_ALIAS(_SRC_ASM _SRC_yasm)
  6316. }
  6317. ### @usage: ASM_PREINCLUDE(AsmFiles...)
  6318. ###
  6319. ### Supply additional .asm files to all assembler calls within a module
  6320. macro ASM_PREINCLUDE(PREINCLUDES...) {
  6321. SET_APPEND(YASM_PREINCLUDES_VALUE $PREINCLUDES)
  6322. }
  6323. ### @usage: RUN_ANTLR(Args...)
  6324. ###
  6325. ### Macro to invoke ANTLR3 generator (general case)
  6326. macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  6327. PEERDIR(build/external_resources/antlr3 build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  6328. .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})
  6329. .SEM=run_antlr OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} DEPENDS ${input:IN} ${pre=WORKING_DIRECTORY :CWD} ANTLER_ARGS $Args
  6330. }
  6331. ### @usage: RUN_ANTLR4(Args...)
  6332. ###
  6333. ### Macro to invoke ANTLR4 generator (general case)
  6334. macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  6335. _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})
  6336. }
  6337. _ANTLR4_LISTENER_GRAMMAR=-listener
  6338. _ANTLR4_LISTENER_PARSER=-listener
  6339. _ANTLR4_LISTENER__ANTLR4_EMPTY=-no-listener
  6340. _ANTLR4_VISITOR_GRAMMAR=-visitor
  6341. _ANTLR4_VISITOR_PARSER=-visitor
  6342. _ANTLR4_VISITOR__ANTLR4_EMPTY=-no-visitor
  6343. ### @usage: RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  6344. ###
  6345. ### Macro to invoke ANTLR4 generator for separate lexer and parser grammars (Cpp)
  6346. macro RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES[], LISTENER?"PARSER":"_ANTLR4_EMPTY", VISITOR?"PARSER":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  6347. 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})
  6348. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  6349. }
  6350. ### @usage: RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  6351. ###
  6352. ### Macro to invoke ANTLR4 generator for combined lexer+parser grammars (Cpp)
  6353. macro RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  6354. 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})
  6355. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  6356. }
  6357. ### @usage: RUN_ANTLR4_GO(GRAMMAR, DEPS <extra_go_deps>, LISTENER, VISITOR, Args...)
  6358. ###
  6359. ### Macro to invoke ANTLR4 generator (Go)
  6360. macro RUN_ANTLR4_GO(GRAMMAR, DEPS[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  6361. 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})
  6362. PEERDIR(${GOSTD}/fmt ${GOSTD}/reflect ${GOSTD}/strconv ${GOSTD}/sync ${GOSTD}/unicode vendor/github.com/antlr/antlr4/runtime/Go/antlr/v4 $DEPS)
  6363. }
  6364. ### @usage: RUN_ANTLR4_PYTHON(Grammar [LISTENER] [VISITOR] [SUBDIR] [EXTRA_OUTS Outs...] Args...)
  6365. ###
  6366. ### `LISTENER` - emit grammar listener
  6367. ### `VISITOR` - emit grammar visitor
  6368. ### `SUBDIR` - place generated files to specified subdirectory of BINDIR
  6369. ### `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.
  6370. ###
  6371. ### 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.
  6372. macro RUN_ANTLR4_PYTHON(GRAMMAR, LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", SUBDIR=".", EXTRA_OUTS[], _ANTLR4_EMPTY="", Args...) {
  6373. 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})
  6374. PEERDIR(contrib/python/antlr4)
  6375. }
  6376. # tag:cpp-specific
  6377. macro CPP_ADDINCL(Dirs...) {
  6378. ADDINCL($Dirs)
  6379. }
  6380. # tag:internal
  6381. _WHOLE_ARCHIVE_PEERS_VALUE=
  6382. ### @usage: WHOLE_ARCHIVE(dirnames...) # internal
  6383. macro WHOLE_ARCHIVE(PEERS...) {
  6384. SET_APPEND(_WHOLE_ARCHIVE_PEERS_VALUE ${PEERS})
  6385. REQUIRES(${PEERS})
  6386. }
  6387. ANDROID_SDK_ROOT=${ANDROID_SDK_RESOURCE_GLOBAL}/android_sdk
  6388. macro TASKLET() {
  6389. PEERDIR(tasklet/api)
  6390. # CPP
  6391. CPP_PROTO_PLUGIN(tasklet_cpp tasklet/v1/gen/cpp .tasklet.h)
  6392. # Python
  6393. PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/v1/gen/python DEPS tasklet/v1/domain/sandbox tasklet/v1/runtime sandbox/sdk2)
  6394. }
  6395. TASKLET_REG_INCLUDES= \
  6396. ${output_include;hide:"tasklet/v1/runtime/lib/cpp_wrapper.h"} \
  6397. ${output_include;hide:"tasklet/v1/runtime/lib/go_wrapper.h"} \
  6398. ${output_include;hide:"tasklet/v1/runtime/lib/py_wrapper.h"} \
  6399. ${output_include;hide:"tasklet/v1/runtime/lib/js_wrapper.h"} \
  6400. ${output_include;hide:"tasklet/v1/runtime/lib/registry.h"}
  6401. macro TASKLET_REG(Name, Lang, Impl, Includes...) {
  6402. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  6403. when($Lang == "js") {
  6404. # JS runtime links the Node.js from contrib as a library, which is a bit heavy,
  6405. # so we do it, only if any JS tasklets are linked into the target
  6406. PEERDIR+=tasklet/v1/runtime/js
  6407. }
  6408. .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"}
  6409. SRCS(GLOBAL $Name.task.cpp)
  6410. }
  6411. # TEMPORARY METHOD FOR EXTENDED REGISTRY SETUP
  6412. # NOT COMPLETE
  6413. macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) {
  6414. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  6415. .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"}
  6416. SRCS(GLOBAL $Name.task.cpp)
  6417. }
  6418. # tag:cpp-specific
  6419. _CPP_PROTO_MODULE_PREFIX=
  6420. _CPP_PROTO_MODULE_SUFFIX=
  6421. when ($MSVC == "yes" || $CYGWIN == "yes") {
  6422. _CPP_PROTO_MODULE_PREFIX=
  6423. _CPP_PROTO_MODULE_SUFFIX=.lib
  6424. }
  6425. otherwise {
  6426. _CPP_PROTO_MODULE_PREFIX=lib
  6427. _CPP_PROTO_MODULE_SUFFIX=.a
  6428. }
  6429. ### @usage: _EXPOSE(OutputsToExport...)
  6430. ###
  6431. ### Allows to mark outputs of macro command as unused in the current module but intended
  6432. ### to be used in modules consuming current via PEERDIR.
  6433. ###
  6434. ### TODO(DEVTOOLS-9000) proper implementation needed
  6435. macro _EXPOSE(Args...) {
  6436. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;suf=$_HASH_HELPER($Args).ya_exposed:"empty_"} ${input;hide:Args}
  6437. }
  6438. ### @usage: LIST_PROTO([TO list.proto] Files...) # deprecated
  6439. ###
  6440. ### Create list of .proto files in a list-file (should be .proto, files.proto by default)
  6441. ### with original .proto-files as list's dependencies.
  6442. ###
  6443. ### This allows to process files listed, passing list as an argument to the processor
  6444. ###
  6445. ### TODO: proper implementation needed
  6446. macro LIST_PROTO(TO="files.proto", Files...) {
  6447. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/list.py"} ${Files} ${input;hide:Files} ${stdout;output;noauto:TO} ${output_include;from_input;hide:Files} && $YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;noext;suf=.pb.h:TO}
  6448. _EXPOSE(${TO})
  6449. }
  6450. # tag:proto
  6451. macro _PROTO_DESC_CMD(File) {
  6452. .CMD=${cwd;rootdir;input:File} $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --descriptor_set_out=${output;suf=.desc:File} --include_source_info $_PROTOC_FLAGS ${input;rootrel:File}
  6453. }
  6454. _PROTO_DESC_MERGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $AUTO_INPUT ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
  6455. _PROTO_DESC_MERGE_PEERS_CMD=$YMAKE_PYTHON ${input:"build/scripts/merge_files.py"} $TARGET $PEERS $SRCS_GLOBAL ${kv;hide:"p PD"} ${kv;hide:"pc light-cyan"}
  6456. NEED_GOOGLE_PROTO_PEERDIRS=yes
  6457. CPP_PROTO_LIBRARY_SEM=$CPP_LIBRARY_SEM
  6458. JAVA_PROTO_LIBRARY_SEM=$BUILD_PROTO_JAR_SEM $_GRADLE_EXPORT_PUBLISHING_SEM
  6459. # tag:proto
  6460. ### @usage: PROTO_LIBRARY()
  6461. ###
  6462. ### Build some varian of protocol buffers library.
  6463. ###
  6464. ### The particular variant is selected based on where PEERDIR to PROTO_LIBRARY comes from.
  6465. ###
  6466. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  6467. ### When PEERDIR comes from module for particular language appropriate variant is selected.
  6468. ### PROTO_LIBRARY also supports emission of GRPC code if GRPC() macro is specified.
  6469. ### Notes:
  6470. ### - Python versions emit C++ code in addition to Python as optimization.
  6471. ### - In some PROTO_LIBRARY-es Java or Python versions are excluded via EXCLUDE_TAGS macros due to incompatibilities.
  6472. ### - Use from DEPENDS or BUNDLE is not allowed
  6473. ###
  6474. ### Documentation: https://wiki.yandex-team.ru/yatool/proto_library/
  6475. ###
  6476. ### See: [GRPC()](#macro_GRPC), [OPTIMIZE_PY_PROTOS()](#macro_OPTIMIZE_PY_PROTOS), [INCLUDE_TAGS()](#macro_INCLUDE_TAGS), [EXCLUDE_TAGS()](#macro_EXCLUDE_TAGS)
  6477. multimodule PROTO_LIBRARY {
  6478. module CPP_PROTO : LIBRARY {
  6479. .ALLOWED=_EXPOSE LIST_PROTO
  6480. # TODO(svidyuk): think about marker which forces semantics inheritance
  6481. .SEM=CPP_PROTO_LIBRARY_SEM
  6482. FORCE_COVERAGE_DISABLED=yes
  6483. ENABLE(CPP_PROTO)
  6484. ENABLE(GEN_PROTO)
  6485. NO_CLANG_TIDY()
  6486. SET(PEERDIR_TAGS CPP_PROTO)
  6487. when ($BUILD_PROTO_AS_EVLOG == "yes" && $USE_VANILLA_PROTOC == "yes") {
  6488. _OK=no
  6489. }
  6490. ASSERT(_OK BUILD_PROTO_AS_EVLOG and USE_VANILLA_PROTOC are incompatible yet)
  6491. MODULE_SUFFIX=$_CPP_PROTO_MODULE_SUFFIX
  6492. MODULE_PREFIX=$_CPP_PROTO_MODULE_PREFIX
  6493. when ($_COMMON_GOOGLE_APIS != "None") {
  6494. PEERDIR += contrib/libs/googleapis-common-protos
  6495. }
  6496. }
  6497. module JAVA_PROTO: EXTERNAL_JAVA_LIBRARY {
  6498. .EXTS=.jsrc
  6499. .ALLOWED=GRPC
  6500. .SEM=JAVA_PROTO_LIBRARY_SEM
  6501. SET(PEERDIR_TAGS JAVA_PROTO)
  6502. ENABLE(JAVA_PROTO)
  6503. PEERDIR+=$JAVA_PROTOBUF_PEERS
  6504. when ($KOTLIN_PROTO == "yes") {
  6505. KOTLIN_PROTO_PEERS=contrib/java/com/google/protobuf/protobuf-kotlin/${JAVA_PROTO_RUNTIME_VERSION}
  6506. KOTLIN_PROTO_FLAGS=--kotlin_out=$ARCADIA_BUILD_ROOT/java_out
  6507. }
  6508. when ($GRADLE_EXPORT_PUBLISHING == "yes") {
  6509. _GRADLE_EXPORT_PUBLISHING_SEM=$_DO_GRADLE_EXPORT_PUBLISHING_SEM
  6510. }
  6511. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_SKIFF CPP_PROTO_PLUGIN2 PY_PROTO_PLUGIN YMAPS_SPROTO RESOURCE
  6512. ADDINCL(FOR proto $PROTOBUF_PATH)
  6513. when ($_COMMON_GOOGLE_APIS != "None") {
  6514. PEERDIR += contrib/java/com/google/api/grpc/proto-google-common-protos/${JAVA_PROTO_COMMON_VERSION}
  6515. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6516. }
  6517. }
  6518. module PY_PROTO: PY2_LIBRARY {
  6519. .ALIASES=SRCS=PY_SRCS
  6520. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  6521. .PEERDIRSELF=CPP_PROTO
  6522. .SEM=IGNORED
  6523. SET(PEERDIR_TAGS PY2 PY_PROTO)
  6524. ENABLE(PY_PROTO)
  6525. OPTIMIZE_PY_PROTOS()
  6526. OBJ_SUF=.py2
  6527. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6528. SET(_NO_LINT_VALUE none_internal)
  6529. when ($_COMMON_GOOGLE_APIS != "None") {
  6530. PEERDIR += contrib/libs/googleapis-common-protos
  6531. }
  6532. _IGNORE_SELF_PEERS=
  6533. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  6534. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  6535. _IGNORE_PEERDIRSELF=CPP_PROTO
  6536. }
  6537. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  6538. }
  6539. module PY3_PROTO: PY3_LIBRARY {
  6540. .ALIASES=SRCS=PY_SRCS
  6541. .ALLOWED=OPTIMIZE_PY_PROTOS NO_OPTIMIZE_PY_PROTOS
  6542. .PEERDIRSELF=CPP_PROTO
  6543. .SEM=IGNORED
  6544. SET(PEERDIR_TAGS PY3 PY3_PROTO)
  6545. ENABLE(PY3_PROTO)
  6546. OPTIMIZE_PY_PROTOS()
  6547. when ($MSVC == "yes" || $CYGWIN == "yes") {
  6548. MODULE_PREFIX=py3
  6549. }
  6550. otherwise {
  6551. MODULE_PREFIX=libpy3
  6552. }
  6553. OBJ_SUF=.py3
  6554. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6555. SET(_NO_LINT_VALUE none_internal)
  6556. when ($_COMMON_GOOGLE_APIS != "None") {
  6557. PEERDIR += contrib/libs/googleapis-common-protos
  6558. }
  6559. _IGNORE_SELF_PEERS=
  6560. _CPP_PROTO_LIBRARY=${MODDIR}/$_CPP_PROTO_MODULE_PREFIX$REALPRJNAME$_CPP_PROTO_MODULE_SUFFIX
  6561. when ($OPTIMIZE_PY_PROTOS_FLAG == "no") {
  6562. _IGNORE_PEERDIRSELF=CPP_PROTO
  6563. }
  6564. SET_APPEND(_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL $_CPP_PROTO_LIBRARY)
  6565. }
  6566. module GO_PROTO: GO_LIBRARY {
  6567. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO
  6568. .SEM=IGNORED
  6569. SET(PEERDIR_TAGS GO GO_PROTO)
  6570. ENABLE(GO_PROTO)
  6571. when ($_COMMON_GOOGLE_APIS == "None") {
  6572. }
  6573. elsewhen ($_COMMON_GOOGLE_APIS == "") {
  6574. PEERDIR += $_GO_COMMON_GOOGLE_APIS
  6575. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6576. }
  6577. otherwise {
  6578. PEERDIR += $_COMMON_GOOGLE_APIS
  6579. ADDINCL += GLOBAL FOR proto ${ARCADIA_ROOT}/contrib/libs/googleapis-common-protos
  6580. }
  6581. }
  6582. module DESC_PROTO: _BARE_UNIT {
  6583. .CMD=_PROTO_DESC_MERGE_CMD
  6584. .SEM=IGNORED
  6585. .EXTS=.desc
  6586. .NODE_TYPE=Library
  6587. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER YMAPS_SPROTO RESOURCE GO_PROTO_PLUGIN GRPC
  6588. SET(PEERDIR_TAGS DESC_PROTO)
  6589. ENABLE(DESC_PROTO)
  6590. MODULE_SUFFIX=.self.protodesc
  6591. SET(MODULE_TYPE LIBRARY)
  6592. MACRO_ALIAS(EVLOG_CMD _PROTO_DESC_CMD)
  6593. MACRO_ALIAS(PROTO_CMD _PROTO_DESC_CMD)
  6594. when ($_COMMON_GOOGLE_APIS != "None") {
  6595. PEERDIR += contrib/libs/googleapis-common-protos
  6596. }
  6597. when ($NEED_GOOGLE_PROTO_PEERDIRS == "yes") {
  6598. when ($USE_VANILLA_PROTOC == "yes") {
  6599. PEERDIR += contrib/libs/protobuf_std/builtin_proto/protos_from_protobuf
  6600. }
  6601. otherwise {
  6602. PEERDIR += contrib/libs/protobuf/builtin_proto/protos_from_protoc
  6603. }
  6604. }
  6605. }
  6606. }
  6607. module PROTO_DESCRIPTIONS: _BARE_UNIT {
  6608. .CMD=_PROTO_DESC_MERGE_PEERS_CMD
  6609. .PEERDIR_POLICY=as_build_from
  6610. .NODE_TYPE=Library
  6611. .RESTRICTED=SRCS
  6612. .FINAL_TARGET=yes
  6613. SET(PEERDIR_TAGS DESC_PROTO)
  6614. SET(MODULE_SUFFIX .protodesc)
  6615. SET(MODULE_TYPE PROTO_DESCRIPTIONS)
  6616. }
  6617. module PROTO_REGISTRY: PROTO_DESCRIPTIONS {
  6618. SET(MODULE_TYPE PROTO_REGISTRY)
  6619. }
  6620. # tag:fbs
  6621. _FBS_NAMESPACE_MAP_GLOBAL=
  6622. # tag:fbs
  6623. macro _FBS_NAMESPACE_IMPL(NAMESPACE, PATH, DUMMY...) {
  6624. SET_APPEND(_FBS_NAMESPACE_MAP_GLOBAL ${NAMESPACE}=${PATH})
  6625. }
  6626. # tag:fbs
  6627. macro FBS_NAMESPACE(NAMESPACE, PATH...) {
  6628. _FBS_NAMESPACE_IMPL($NAMESPACE $PATH $MODDIR)
  6629. }
  6630. # tag:fbs
  6631. ### @usage: FBS_LIBRARY()
  6632. ###
  6633. ### Build some variant of Flatbuffers library.
  6634. ###
  6635. ### The particular variant is selected based on where PEERDIR to FBS_LIBRARY
  6636. ### comes from.
  6637. ###
  6638. ### Now supported 5 variants: C++, Java, Python 2.x, Python 3.x and Go.
  6639. ### When PEERDIR comes from module for particular language appropriate variant
  6640. ### is selected.
  6641. ###
  6642. ### Notes: FBS_NAMESPACE must be specified in all dependent FBS_LIBRARY modules
  6643. ### if build of Go code is requested.
  6644. multimodule FBS_LIBRARY {
  6645. module CPP_FBS: LIBRARY {
  6646. ENABLE(CPP_FBS)
  6647. SET(PEERDIR_TAGS CPP_FBS)
  6648. }
  6649. module GO_FBS: GO_LIBRARY {
  6650. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  6651. ENABLE(GO_FBS)
  6652. SET(PEERDIR_TAGS GO GO_FBS)
  6653. }
  6654. module JAVA_FBS: EXTERNAL_JAVA_LIBRARY {
  6655. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  6656. ENABLE(JAVA_FBS)
  6657. SET(PEERDIR_TAGS JAVA_FBS)
  6658. }
  6659. module PY2_FBS: PY2_LIBRARY {
  6660. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  6661. .ALIASES=SRCS=PY_SRCS
  6662. ENABLE(PY2_FBS)
  6663. SET(PEERDIR_TAGS PY2 PY2_FBS)
  6664. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6665. SET(_NO_LINT_VALUE none_internal)
  6666. }
  6667. module PY3_FBS: PY3_LIBRARY {
  6668. .IGNORED=GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER
  6669. .ALIASES=SRCS=PY_SRCS
  6670. ENABLE(PY3_FBS)
  6671. SET(PEERDIR_TAGS PY3 PY3_FBS)
  6672. # Can not use NO_LINT(), because is not allowed outside of contrib directory
  6673. SET(_NO_LINT_VALUE none_internal)
  6674. when ($MSVC == "yes" || $CYGWIN == "yes") {
  6675. MODULE_PREFIX=py3
  6676. }
  6677. otherwise {
  6678. MODULE_PREFIX=libpy3
  6679. }
  6680. OBJ_SUF=.py3
  6681. }
  6682. }
  6683. # tag:java-specific
  6684. _COMPILE_JSRC=${cwd:ARCADIA_BUILD_ROOT} $YMAKE_PYTHON ${input:"build/scripts/compile_jsrc.py"} --input $AUTO_INPUT --output $TARGET --prefix $BINDIR ${kv;hide:"p JC"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  6685. # tag:java-specific
  6686. COMPILE_JSRC_MF=$_COMPILE_JSRC && $GENERATE_MF
  6687. # tag:java-specific tag:internal
  6688. ### @usage: JSRC_LIBRARY() # internal
  6689. module JSRC_LIBRARY: _BARE_UNIT {
  6690. .CMD=COMPILE_JSRC_MF
  6691. .EXTS=.java
  6692. .PEERDIR_POLICY=as_include
  6693. .FINAL_TARGET=no
  6694. .ALIASES=SRCS=FILES
  6695. PEERDIR_TAGS=JAVA_PROTO JAVA_FBS JAVA_IDL
  6696. MODULE_TYPE=LIBRARY
  6697. SET(MODULE_SUFFIX .jsrc)
  6698. SET(DONT_RESOLVE_INCLUDES yes)
  6699. SET(NEED_PLATFORM_PEERDIRS no)
  6700. SET(MODULE_LANG JAVA)
  6701. NO_RUNTIME()
  6702. }
  6703. # tag:maps-specific
  6704. @import "${CONF_ROOT}/conf/project_specific/maps/asrc.conf"
  6705. # tag:internal
  6706. ### @usage: _PROXY_LIBRARY() # internal
  6707. ###
  6708. ### The use of this module is strictly prohibited!!!
  6709. module _PROXY_LIBRARY: LIBRARY {
  6710. .EXTS=.a .lib
  6711. .PEERDIR_POLICY=as_build_from
  6712. .PROXY=yes
  6713. .FINAL_TARGET=yes
  6714. DISABLE(NEED_ADD_FAKE_SRC)
  6715. NO_UTIL()
  6716. NO_RUNTIME()
  6717. }
  6718. # tag:maps-specific
  6719. @import "${CONF_ROOT}/conf/project_specific/maps/aar.conf"
  6720. @import "${CONF_ROOT}/conf/project_specific/maps/sproto.conf"
  6721. @import "${CONF_ROOT}/conf/project_specific/maps/mapkit.conf"
  6722. _PRIMARY_OUTPUT_VALUE=
  6723. # tag:internal
  6724. ### @usage: PRIMARY_OUTPUT_VALUE(Output) # internal
  6725. ###
  6726. ### The use of this module is strictly prohibited!!!
  6727. macro PRIMARY_OUTPUT(OUTPUT) {
  6728. SET(_PRIMARY_OUTPUT_VALUE $OUTPUT)
  6729. }
  6730. _DLL_PROXY_LIBRARY_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${input;hide:_PRIMARY_OUTPUT_VALUE} ${TARGET}
  6731. # tag:internal
  6732. ### @usage: DLL_PROXY_LIBRARY() # internal
  6733. ###
  6734. ### The use of this module is strictly prohibited!!!
  6735. module DLL_PROXY_LIBRARY: _PROXY_LIBRARY {
  6736. .ALLOWED=PRIMARY_OUTPUT
  6737. .CMD=_DLL_PROXY_LIBRARY_CMD
  6738. }
  6739. _PREBUILT_PROGRAM_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${TARGET} ${kv;hide:"p ld"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  6740. # tag:internal
  6741. ### @usage: PREBUILT_PROGRAM([programname]) # internal
  6742. ###
  6743. ### Program module which uses a prebuilt prgram as its output.
  6744. module PREBUILT_PROGRAM: _LINK_UNIT {
  6745. .CMD=_PREBUILT_PROGRAM_CMD
  6746. .SYMLINK_POLICY=EXE
  6747. .ALLOWED=INDUCED_DEPS PRIMARY_OUTPUT
  6748. .RESTRICTED=SRCS
  6749. _BARE_LINK_MODULE()
  6750. SET(MODULE_TYPE PROGRAM)
  6751. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  6752. MODULE_SUFFIX=.exe
  6753. }
  6754. }
  6755. ### @usage COLLECT_JINJA_TEMPLATES(varname path)
  6756. ###
  6757. ### This macro collects all jinja and yaml files in the directory specified by second argument and
  6758. ### stores result in the variable with mane specified by first parameter.
  6759. macro COLLECT_JINJA_TEMPLATES(VAR, DIR) {
  6760. _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml)
  6761. }
  6762. @import "${CONF_ROOT}/conf/go.conf"
  6763. # Conflict between protobuf-java and protobuf-javalite ¯\_(ツ)_/¯
  6764. # both libraries are required by grpc
  6765. JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE=\
  6766. com.google.protobuf.AbstractMessageLite \
  6767. com.google.protobuf.AbstractMessageLite$Builder \
  6768. com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream \
  6769. com.google.protobuf.AbstractMessageLite$InternalOneOfEnum \
  6770. com.google.protobuf.AbstractParser \
  6771. com.google.protobuf.AbstractProtobufList \
  6772. com.google.protobuf.AllocatedBuffer \
  6773. com.google.protobuf.AllocatedBuffer$1 \
  6774. com.google.protobuf.AllocatedBuffer$2 \
  6775. com.google.protobuf.Android \
  6776. com.google.protobuf.Any \
  6777. com.google.protobuf.Any$1 \
  6778. com.google.protobuf.Any$Builder \
  6779. com.google.protobuf.AnyOrBuilder \
  6780. com.google.protobuf.AnyProto \
  6781. com.google.protobuf.Api \
  6782. com.google.protobuf.Api$1 \
  6783. com.google.protobuf.Api$Builder \
  6784. com.google.protobuf.ApiOrBuilder \
  6785. com.google.protobuf.ApiProto \
  6786. com.google.protobuf.ArrayDecoders \
  6787. com.google.protobuf.ArrayDecoders$1 \
  6788. com.google.protobuf.ArrayDecoders$Registers \
  6789. com.google.protobuf.BinaryReader \
  6790. com.google.protobuf.BinaryReader$1 \
  6791. com.google.protobuf.BinaryReader$SafeHeapReader \
  6792. com.google.protobuf.BinaryWriter \
  6793. com.google.protobuf.BinaryWriter$1 \
  6794. com.google.protobuf.BinaryWriter$SafeDirectWriter \
  6795. com.google.protobuf.BinaryWriter$SafeHeapWriter \
  6796. com.google.protobuf.BinaryWriter$UnsafeDirectWriter \
  6797. com.google.protobuf.BinaryWriter$UnsafeHeapWriter \
  6798. com.google.protobuf.BooleanArrayList \
  6799. com.google.protobuf.BoolValue \
  6800. com.google.protobuf.BoolValue$1 \
  6801. com.google.protobuf.BoolValue$Builder \
  6802. com.google.protobuf.BoolValueOrBuilder \
  6803. com.google.protobuf.BufferAllocator \
  6804. com.google.protobuf.BufferAllocator$1 \
  6805. com.google.protobuf.ByteBufferWriter \
  6806. com.google.protobuf.ByteOutput \
  6807. com.google.protobuf.ByteString \
  6808. com.google.protobuf.ByteString$1 \
  6809. com.google.protobuf.ByteString$2 \
  6810. com.google.protobuf.ByteString$AbstractByteIterator \
  6811. com.google.protobuf.ByteString$ArraysByteArrayCopier \
  6812. com.google.protobuf.ByteString$BoundedByteString \
  6813. com.google.protobuf.ByteString$ByteArrayCopier \
  6814. com.google.protobuf.ByteString$ByteIterator \
  6815. com.google.protobuf.ByteString$CodedBuilder \
  6816. com.google.protobuf.ByteString$LeafByteString \
  6817. com.google.protobuf.ByteString$LiteralByteString \
  6818. com.google.protobuf.ByteString$Output \
  6819. com.google.protobuf.ByteString$SystemByteArrayCopier \
  6820. com.google.protobuf.BytesValue \
  6821. com.google.protobuf.BytesValue$1 \
  6822. com.google.protobuf.BytesValue$Builder \
  6823. com.google.protobuf.BytesValueOrBuilder \
  6824. com.google.protobuf.CanIgnoreReturnValue \
  6825. com.google.protobuf.CheckReturnValue \
  6826. com.google.protobuf.CodedInputStream \
  6827. com.google.protobuf.CodedInputStream$1 \
  6828. com.google.protobuf.CodedInputStream$ArrayDecoder \
  6829. com.google.protobuf.CodedInputStream$IterableDirectByteBufferDecoder \
  6830. com.google.protobuf.CodedInputStream$StreamDecoder \
  6831. com.google.protobuf.CodedInputStream$StreamDecoder$RefillCallback \
  6832. com.google.protobuf.CodedInputStream$StreamDecoder$SkippedDataSink \
  6833. com.google.protobuf.CodedInputStream$UnsafeDirectNioDecoder \
  6834. com.google.protobuf.CodedInputStreamReader \
  6835. com.google.protobuf.CodedInputStreamReader$1 \
  6836. com.google.protobuf.CodedOutputStream \
  6837. com.google.protobuf.CodedOutputStream$1 \
  6838. com.google.protobuf.CodedOutputStream$AbstractBufferedEncoder \
  6839. com.google.protobuf.CodedOutputStream$ArrayEncoder \
  6840. com.google.protobuf.CodedOutputStream$ByteOutputEncoder \
  6841. com.google.protobuf.CodedOutputStream$HeapNioEncoder \
  6842. com.google.protobuf.CodedOutputStream$OutOfSpaceException \
  6843. com.google.protobuf.CodedOutputStream$OutputStreamEncoder \
  6844. com.google.protobuf.CodedOutputStream$SafeDirectNioEncoder \
  6845. com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder \
  6846. com.google.protobuf.CodedOutputStreamWriter \
  6847. com.google.protobuf.CodedOutputStreamWriter$1 \
  6848. com.google.protobuf.DoubleArrayList \
  6849. com.google.protobuf.DoubleValue \
  6850. com.google.protobuf.DoubleValue$1 \
  6851. com.google.protobuf.DoubleValue$Builder \
  6852. com.google.protobuf.DoubleValueOrBuilder \
  6853. com.google.protobuf.Duration \
  6854. com.google.protobuf.Duration$1 \
  6855. com.google.protobuf.Duration$Builder \
  6856. com.google.protobuf.DurationOrBuilder \
  6857. com.google.protobuf.DurationProto \
  6858. com.google.protobuf.Empty \
  6859. com.google.protobuf.Empty$1 \
  6860. com.google.protobuf.Empty$Builder \
  6861. com.google.protobuf.EmptyOrBuilder \
  6862. com.google.protobuf.EmptyProto \
  6863. com.google.protobuf.Enum \
  6864. com.google.protobuf.Enum$1 \
  6865. com.google.protobuf.Enum$Builder \
  6866. com.google.protobuf.EnumOrBuilder \
  6867. com.google.protobuf.EnumValue \
  6868. com.google.protobuf.EnumValue$1 \
  6869. com.google.protobuf.EnumValue$Builder \
  6870. com.google.protobuf.EnumValueOrBuilder \
  6871. com.google.protobuf.ExperimentalApi \
  6872. com.google.protobuf.ExtensionLite \
  6873. com.google.protobuf.ExtensionRegistryFactory \
  6874. com.google.protobuf.ExtensionRegistryLite \
  6875. com.google.protobuf.ExtensionRegistryLite$ExtensionClassHolder \
  6876. com.google.protobuf.ExtensionRegistryLite$ObjectIntPair \
  6877. com.google.protobuf.ExtensionSchema \
  6878. com.google.protobuf.ExtensionSchemaLite \
  6879. com.google.protobuf.ExtensionSchemaLite$1 \
  6880. com.google.protobuf.ExtensionSchemas \
  6881. com.google.protobuf.Field \
  6882. com.google.protobuf.Field$1 \
  6883. com.google.protobuf.Field$Builder \
  6884. com.google.protobuf.Field$Cardinality \
  6885. com.google.protobuf.Field$Cardinality$1 \
  6886. com.google.protobuf.Field$Kind \
  6887. com.google.protobuf.Field$Kind$1 \
  6888. com.google.protobuf.FieldInfo \
  6889. com.google.protobuf.FieldInfo$1 \
  6890. com.google.protobuf.FieldInfo$Builder \
  6891. com.google.protobuf.FieldMask \
  6892. com.google.protobuf.FieldMask$1 \
  6893. com.google.protobuf.FieldMask$Builder \
  6894. com.google.protobuf.FieldMaskOrBuilder \
  6895. com.google.protobuf.FieldMaskProto \
  6896. com.google.protobuf.FieldOrBuilder \
  6897. com.google.protobuf.FieldSet \
  6898. com.google.protobuf.FieldSet$1 \
  6899. com.google.protobuf.FieldSet$Builder \
  6900. com.google.protobuf.FieldSet$FieldDescriptorLite \
  6901. com.google.protobuf.FieldType \
  6902. com.google.protobuf.FieldType$1 \
  6903. com.google.protobuf.FieldType$Collection \
  6904. com.google.protobuf.FloatArrayList \
  6905. com.google.protobuf.FloatValue \
  6906. com.google.protobuf.FloatValue$1 \
  6907. com.google.protobuf.FloatValue$Builder \
  6908. com.google.protobuf.FloatValueOrBuilder \
  6909. com.google.protobuf.GeneratedMessageInfoFactory \
  6910. com.google.protobuf.GeneratedMessageLite \
  6911. com.google.protobuf.GeneratedMessageLite$1 \
  6912. com.google.protobuf.GeneratedMessageLite$Builder \
  6913. com.google.protobuf.GeneratedMessageLite$DefaultInstanceBasedParser \
  6914. com.google.protobuf.GeneratedMessageLite$ExtendableBuilder \
  6915. com.google.protobuf.GeneratedMessageLite$ExtendableMessage \
  6916. com.google.protobuf.GeneratedMessageLite$ExtendableMessage$ExtensionWriter \
  6917. com.google.protobuf.GeneratedMessageLite$ExtendableMessageOrBuilder \
  6918. com.google.protobuf.GeneratedMessageLite$ExtensionDescriptor \
  6919. com.google.protobuf.GeneratedMessageLite$GeneratedExtension \
  6920. com.google.protobuf.GeneratedMessageLite$MethodToInvoke \
  6921. com.google.protobuf.GeneratedMessageLite$SerializedForm \
  6922. com.google.protobuf.Int32Value \
  6923. com.google.protobuf.Int32Value$1 \
  6924. com.google.protobuf.Int32Value$Builder \
  6925. com.google.protobuf.Int32ValueOrBuilder \
  6926. com.google.protobuf.Int64Value \
  6927. com.google.protobuf.Int64Value$1 \
  6928. com.google.protobuf.Int64Value$Builder \
  6929. com.google.protobuf.Int64ValueOrBuilder \
  6930. com.google.protobuf.IntArrayList \
  6931. com.google.protobuf.Internal \
  6932. com.google.protobuf.Internal$BooleanList \
  6933. com.google.protobuf.Internal$DoubleList \
  6934. com.google.protobuf.Internal$EnumLite \
  6935. com.google.protobuf.Internal$EnumLiteMap \
  6936. com.google.protobuf.Internal$EnumVerifier \
  6937. com.google.protobuf.Internal$FloatList \
  6938. com.google.protobuf.Internal$IntList \
  6939. com.google.protobuf.Internal$ListAdapter \
  6940. com.google.protobuf.Internal$ListAdapter$Converter \
  6941. com.google.protobuf.Internal$LongList \
  6942. com.google.protobuf.Internal$MapAdapter \
  6943. com.google.protobuf.Internal$MapAdapter$1 \
  6944. com.google.protobuf.Internal$MapAdapter$Converter \
  6945. com.google.protobuf.Internal$MapAdapter$EntryAdapter \
  6946. com.google.protobuf.Internal$MapAdapter$IteratorAdapter \
  6947. com.google.protobuf.Internal$MapAdapter$SetAdapter \
  6948. com.google.protobuf.Internal$ProtobufList \
  6949. com.google.protobuf.InvalidProtocolBufferException \
  6950. com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException \
  6951. com.google.protobuf.IterableByteBufferInputStream \
  6952. com.google.protobuf.JavaType \
  6953. com.google.protobuf.LazyField \
  6954. com.google.protobuf.LazyField$1 \
  6955. com.google.protobuf.LazyField$LazyEntry \
  6956. com.google.protobuf.LazyField$LazyIterator \
  6957. com.google.protobuf.LazyFieldLite \
  6958. com.google.protobuf.LazyStringArrayList \
  6959. com.google.protobuf.LazyStringArrayList$ByteArrayListView \
  6960. com.google.protobuf.LazyStringArrayList$ByteStringListView \
  6961. com.google.protobuf.LazyStringList \
  6962. com.google.protobuf.ListFieldSchema \
  6963. com.google.protobuf.ListFieldSchema$1 \
  6964. com.google.protobuf.ListFieldSchema$ListFieldSchemaFull \
  6965. com.google.protobuf.ListFieldSchema$ListFieldSchemaLite \
  6966. com.google.protobuf.ListValue \
  6967. com.google.protobuf.ListValue$1 \
  6968. com.google.protobuf.ListValue$Builder \
  6969. com.google.protobuf.ListValueOrBuilder \
  6970. com.google.protobuf.LongArrayList \
  6971. com.google.protobuf.ManifestSchemaFactory \
  6972. com.google.protobuf.ManifestSchemaFactory$1 \
  6973. com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory \
  6974. com.google.protobuf.MapEntryLite \
  6975. com.google.protobuf.MapEntryLite$1 \
  6976. com.google.protobuf.MapEntryLite$Metadata \
  6977. com.google.protobuf.MapFieldLite \
  6978. com.google.protobuf.MapFieldSchema \
  6979. com.google.protobuf.MapFieldSchemaLite \
  6980. com.google.protobuf.MapFieldSchemas \
  6981. com.google.protobuf.MessageInfo \
  6982. com.google.protobuf.MessageInfoFactory \
  6983. com.google.protobuf.MessageLite \
  6984. com.google.protobuf.MessageLite$Builder \
  6985. com.google.protobuf.MessageLiteOrBuilder \
  6986. com.google.protobuf.MessageLiteToString \
  6987. com.google.protobuf.MessageSchema \
  6988. com.google.protobuf.MessageSchema$1 \
  6989. com.google.protobuf.MessageSetSchema \
  6990. com.google.protobuf.Method \
  6991. com.google.protobuf.Method$1 \
  6992. com.google.protobuf.Method$Builder \
  6993. com.google.protobuf.MethodOrBuilder \
  6994. com.google.protobuf.Mixin \
  6995. com.google.protobuf.Mixin$1 \
  6996. com.google.protobuf.Mixin$Builder \
  6997. com.google.protobuf.MixinOrBuilder \
  6998. com.google.protobuf.MutabilityOracle \
  6999. com.google.protobuf.MutabilityOracle$1 \
  7000. com.google.protobuf.NewInstanceSchema \
  7001. com.google.protobuf.NewInstanceSchemaLite \
  7002. com.google.protobuf.NewInstanceSchemas \
  7003. com.google.protobuf.NioByteString \
  7004. com.google.protobuf.NioByteString$1 \
  7005. com.google.protobuf.NullValue \
  7006. com.google.protobuf.NullValue$1 \
  7007. com.google.protobuf.OneofInfo \
  7008. com.google.protobuf.Option \
  7009. com.google.protobuf.Option$1 \
  7010. com.google.protobuf.Option$Builder \
  7011. com.google.protobuf.OptionOrBuilder \
  7012. com.google.protobuf.Parser \
  7013. com.google.protobuf.PrimitiveNonBoxingCollection \
  7014. com.google.protobuf.Protobuf \
  7015. com.google.protobuf.ProtobufArrayList \
  7016. com.google.protobuf.ProtobufLists \
  7017. com.google.protobuf.ProtocolStringList \
  7018. com.google.protobuf.ProtoSyntax \
  7019. com.google.protobuf.RawMessageInfo \
  7020. com.google.protobuf.Reader \
  7021. com.google.protobuf.RopeByteString \
  7022. com.google.protobuf.RopeByteString$1 \
  7023. com.google.protobuf.RopeByteString$Balancer \
  7024. com.google.protobuf.RopeByteString$PieceIterator \
  7025. com.google.protobuf.RopeByteString$RopeInputStream \
  7026. com.google.protobuf.Schema \
  7027. com.google.protobuf.SchemaFactory \
  7028. com.google.protobuf.SchemaUtil \
  7029. com.google.protobuf.SmallSortedMap \
  7030. com.google.protobuf.SmallSortedMap$1 \
  7031. com.google.protobuf.SmallSortedMap$DescendingEntryIterator \
  7032. com.google.protobuf.SmallSortedMap$DescendingEntrySet \
  7033. com.google.protobuf.SmallSortedMap$EmptySet \
  7034. com.google.protobuf.SmallSortedMap$EmptySet$1 \
  7035. com.google.protobuf.SmallSortedMap$EmptySet$2 \
  7036. com.google.protobuf.SmallSortedMap$Entry \
  7037. com.google.protobuf.SmallSortedMap$EntryIterator \
  7038. com.google.protobuf.SmallSortedMap$EntrySet \
  7039. com.google.protobuf.SourceContext \
  7040. com.google.protobuf.SourceContext$1 \
  7041. com.google.protobuf.SourceContext$Builder \
  7042. com.google.protobuf.SourceContextOrBuilder \
  7043. com.google.protobuf.SourceContextProto \
  7044. com.google.protobuf.StringValue \
  7045. com.google.protobuf.StringValue$1 \
  7046. com.google.protobuf.StringValue$Builder \
  7047. com.google.protobuf.StringValueOrBuilder \
  7048. com.google.protobuf.Struct \
  7049. com.google.protobuf.Struct$1 \
  7050. com.google.protobuf.Struct$Builder \
  7051. com.google.protobuf.Struct$FieldsDefaultEntryHolder \
  7052. com.google.protobuf.StructOrBuilder \
  7053. com.google.protobuf.StructProto \
  7054. com.google.protobuf.StructuralMessageInfo \
  7055. com.google.protobuf.StructuralMessageInfo$Builder \
  7056. com.google.protobuf.Syntax \
  7057. com.google.protobuf.Syntax$1 \
  7058. com.google.protobuf.TextFormatEscaper \
  7059. com.google.protobuf.TextFormatEscaper$1 \
  7060. com.google.protobuf.TextFormatEscaper$2 \
  7061. com.google.protobuf.TextFormatEscaper$ByteSequence \
  7062. com.google.protobuf.Timestamp \
  7063. com.google.protobuf.Timestamp$1 \
  7064. com.google.protobuf.Timestamp$Builder \
  7065. com.google.protobuf.TimestampOrBuilder \
  7066. com.google.protobuf.TimestampProto \
  7067. com.google.protobuf.Type \
  7068. com.google.protobuf.Type$1 \
  7069. com.google.protobuf.Type$Builder \
  7070. com.google.protobuf.TypeOrBuilder \
  7071. com.google.protobuf.TypeProto \
  7072. com.google.protobuf.UInt32Value \
  7073. com.google.protobuf.UInt32Value$1 \
  7074. com.google.protobuf.UInt32Value$Builder \
  7075. com.google.protobuf.UInt32ValueOrBuilder \
  7076. com.google.protobuf.UInt64Value \
  7077. com.google.protobuf.UInt64Value$1 \
  7078. com.google.protobuf.UInt64Value$Builder \
  7079. com.google.protobuf.UInt64ValueOrBuilder \
  7080. com.google.protobuf.UninitializedMessageException \
  7081. com.google.protobuf.UnknownFieldSchema \
  7082. com.google.protobuf.UnknownFieldSetLite \
  7083. com.google.protobuf.UnknownFieldSetLiteSchema \
  7084. com.google.protobuf.UnmodifiableLazyStringList \
  7085. com.google.protobuf.UnmodifiableLazyStringList$1 \
  7086. com.google.protobuf.UnmodifiableLazyStringList$2 \
  7087. com.google.protobuf.UnsafeByteOperations \
  7088. com.google.protobuf.UnsafeUtil \
  7089. com.google.protobuf.UnsafeUtil$1 \
  7090. com.google.protobuf.UnsafeUtil$Android32MemoryAccessor \
  7091. com.google.protobuf.UnsafeUtil$Android64MemoryAccessor \
  7092. com.google.protobuf.UnsafeUtil$JvmMemoryAccessor \
  7093. com.google.protobuf.UnsafeUtil$MemoryAccessor \
  7094. com.google.protobuf.Utf8 \
  7095. com.google.protobuf.Utf8$DecodeUtil \
  7096. com.google.protobuf.Utf8$Processor \
  7097. com.google.protobuf.Utf8$SafeProcessor \
  7098. com.google.protobuf.Utf8$UnpairedSurrogateException \
  7099. com.google.protobuf.Utf8$UnsafeProcessor \
  7100. com.google.protobuf.Value \
  7101. com.google.protobuf.Value$1 \
  7102. com.google.protobuf.Value$Builder \
  7103. com.google.protobuf.Value$KindCase \
  7104. com.google.protobuf.ValueOrBuilder \
  7105. com.google.protobuf.WireFormat \
  7106. com.google.protobuf.WireFormat$1 \
  7107. com.google.protobuf.WireFormat$FieldType \
  7108. com.google.protobuf.WireFormat$FieldType$1 \
  7109. com.google.protobuf.WireFormat$FieldType$2 \
  7110. com.google.protobuf.WireFormat$FieldType$3 \
  7111. com.google.protobuf.WireFormat$FieldType$4 \
  7112. com.google.protobuf.WireFormat$JavaType \
  7113. com.google.protobuf.WireFormat$Utf8Validation \
  7114. com.google.protobuf.WireFormat$Utf8Validation$1 \
  7115. com.google.protobuf.WireFormat$Utf8Validation$2 \
  7116. com.google.protobuf.WireFormat$Utf8Validation$3 \
  7117. com.google.protobuf.WrappersProto \
  7118. com.google.protobuf.Writer \
  7119. com.google.protobuf.Writer$FieldOrder
  7120. # tag:java-specific
  7121. JAVA_IGNORE_CLASSPATH_CLASH_VALUE=$JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE
  7122. ### @usage: JAVA_IGNORE_CLASSPATH_CLASH_FOR([classes])
  7123. ### Ignore classpath clash test fails for classes
  7124. macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) {
  7125. SET_APPEND(JAVA_IGNORE_CLASSPATH_CLASH_VALUE $Args $JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE)
  7126. }
  7127. # tag:python-specific
  7128. ### @usage: PY_SRCS({| CYTHON_C} { | TOP_LEVEL | NAMESPACE ns} Files...)
  7129. ###
  7130. ### Build specified Python sources according to Arcadia binary Python build. Basically creates precompiled and source resources keyed with module paths.
  7131. ### The resources eventually are linked into final program and can be accessed as regular Python modules.
  7132. ### This custom loader linked into the program will add them to sys.meta_path.
  7133. ###
  7134. ### PY_SRCS also support .proto, .ev, .pyx and .swg files. The .proto and .ev are compiled to .py-code by protoc and than handled as usual .py files.
  7135. ### .pyx and .swg lead to C/C++ Python extensions generation, that are automatically registered in Python as built-in modules.
  7136. ###
  7137. ### By default .pyx files are built as C++-extensions. Use CYTHON_C to build them as C (similar to BUILDWITH_CYTHON_C, but with the ability to specify namespace).
  7138. ###
  7139. ### __init__.py never required, but if present (and specified in PY_SRCS), it will be imported when you import package modules with __init__.py Oh.
  7140. ###
  7141. ### @example
  7142. ###
  7143. ### PY2_LIBRARY(mymodule)
  7144. ### PY_SRCS(a.py sub/dir/b.py e.proto sub/dir/f.proto c.pyx sub/dir/d.pyx g.swg sub/dir/h.swg)
  7145. ### END()
  7146. ###
  7147. ### PY_SRCS honors Python2 and Python3 differences and adjusts itself to Python version of a current module.
  7148. ### PY_SRCS can be used in any Arcadia Python build modules like PY*_LIBRARY, PY*_PROGRAM, PY*TEST.
  7149. ### PY_SRCS in LIBRARY or PROGRAM effectively converts these into PY2_LIBRARY and PY2_PROGRAM respectively.
  7150. ### It is strongly advised to make this conversion explicit. Never use PY_SRCS in a LIBRARY if you plan to use it from external Python extension module.
  7151. ###
  7152. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs/#modulipylibrarypy3libraryimakrospysrcs
  7153. macro PY_SRCS() {
  7154. DEFAULT(MODULE_TAG PY2)
  7155. DEFAULT(PYTHON2 yes)
  7156. DEFAULT(PYTHON3 no)
  7157. }
  7158. # tag:python-specific
  7159. _ALL_PY_FILES=
  7160. # tag:python-specific
  7161. macro _ALL_PY_SRCS2(TOP_LEVEL?"TOP_LEVEL":"", RECURSIVE?"/**":"", ONLY_TEST_FILES?"test_*.py":"*.py", ONLY_TEST_FILES2?"*_test.py":"***", NO_TEST_FILES?"**/test_*.py **/*_test.py":"", NAMESPACE[], REST[], REST2[], EAT_TAIL[]) {
  7162. _GLOB(_ALL_PY_FILES ${suf=${RECURSIVE}/${ONLY_TEST_FILES}:REST} ${suf=${RECURSIVE}/${ONLY_TEST_FILES2}:REST2} ${suf=${RECURSIVE}/ya.make:REST} EXCLUDE ya.make ${NO_TEST_FILES})
  7163. }
  7164. # tag:python-specific
  7165. ### @usage: ALL_PY_SRCS([RECURSIVE] [NO_TEST_FILES] { | TOP_LEVEL | NAMESPACE ns} [Dirs...])
  7166. ###
  7167. ### Puts all .py-files from given Dirs (relative to projects') into PY_SRCS of the current module.
  7168. ### If Dirs is ommitted project directory is used
  7169. ###
  7170. ### `RECURSIVE` makes lookup recursive with resprect to Dirs
  7171. ### `NO_TEST_FILES` excludes files `test_*.py` and `*_test.py` those are normally subject to `TEST_SRCS`
  7172. ### `TOP_LEVEL` and `NAMESPACE` are forwarded to `PY_SRCS`
  7173. ###
  7174. ### Note: Only one such macro per module is allowed
  7175. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  7176. ###
  7177. ### @see [PY_SRCS()](#macro_PY_SRCS)
  7178. macro ALL_PY_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", NO_TEST_FILES?"NO_TEST_FILES":"", Files...) {
  7179. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} ${NO_TEST_FILES} REST .${pre=/:Files})
  7180. PY_SRCS(_MR ${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} $_ALL_PY_FILES)
  7181. }
  7182. # tag:python-specific
  7183. ### @usage: ALL_PYTEST_SRCS([RECURSIVE] [Dirs...])
  7184. ###
  7185. ### Puts all .py-files from given Dirs (relative to projects') into TEST_SRCS of the current module.
  7186. ### If Dirs is omitted project directory is used
  7187. ###
  7188. ### `RECURSIVE` makes lookup recursive with respect to Dirs
  7189. ### `ONLY_TEST_FILES` includes only files `test_*.py` and `*_test.py`, others are normally subject to `PY_SRCS`
  7190. ###
  7191. ### Note: Only one such macro per module is allowed
  7192. ### Note: Macro is designed to reject any ya.make files in Dirs except current one
  7193. ###
  7194. ### @see [TEST_SRCS()](#macro_TEST_SRCS)
  7195. macro ALL_PYTEST_SRCS(TOP_LEVEL?"TOP_LEVEL":"", NAMESPACE="", RECURSIVE?"RECURSIVE":"", ONLY_TEST_FILES?"ONLY_TEST_FILES ONLY_TEST_FILES2 REST2":"EAT_TAIL", Files...) {
  7196. _ALL_PY_SRCS2(${pre=NAMESPACE :NAMESPACE} ${TOP_LEVEL} ${RECURSIVE} REST .${pre=/:Files} ${ONLY_TEST_FILES} .${pre=/:Files})
  7197. TEST_SRCS(_MR $_ALL_PY_FILES)
  7198. }
  7199. # tag:python-specific
  7200. _PY_EXTRA_LINT_FILES_VALUE=
  7201. ### @usage: PY_EXTRA_LINT_FILES(files...)
  7202. ###
  7203. ### Add extra Python files for linting. This macro allows adding
  7204. ### Python files which has no .py extension.
  7205. macro PY_EXTRA_LINT_FILES(FILES...) {
  7206. SET_APPEND(_PY_EXTRA_LINT_FILES_VALUE $FILES)
  7207. }
  7208. # tag:python-specific
  7209. ### @usage: PY23_LIBRARY([name])
  7210. ###
  7211. ### Build PY2_LIBRARY or PY3_LIBRARY depending on incoming PEERDIR.
  7212. ### Direct build or build by RECURSE creates both variants.
  7213. ### This multimodule doesn't define any final targets, so use from DEPENDS or BUNDLE is not allowed.
  7214. ###
  7215. ### Documentation: https://wiki.yandex-team.ru/arcadia/python/pysrcs
  7216. multimodule PY23_LIBRARY {
  7217. module PY2: PY2_LIBRARY {
  7218. .RESTRICTED=RUN_ANTLR4_PYTHON
  7219. OBJ_SUF=.py2
  7220. }
  7221. module PY3: PY3_LIBRARY {
  7222. .RESTRICTED=RUN_ANTLR4_PYTHON
  7223. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  7224. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7225. MODULE_PREFIX=py3
  7226. }
  7227. otherwise {
  7228. MODULE_PREFIX=libpy3
  7229. }
  7230. OBJ_SUF=.py3
  7231. }
  7232. }
  7233. # tag:python-specific
  7234. ### @usage: PY23_NATIVE_LIBRARY([name])
  7235. ###
  7236. ### Build LIBRARY compatible with either Python 2.x or Python 3.x depending on incoming PEERDIR.
  7237. ###
  7238. ### This multimodule doesn't depend on Arcadia Python binary build. It is intended only for C++ code and cannot contain PY_SRCS and USE_PYTHON2 macros.
  7239. ### Use these multimodule instead of PY23_LIBRARY if the C++ extension defined in it will be used in PY2MODULE.
  7240. ### While it doesn't bring Arcadia Python dependency itself, it is still compatible with Arcadia Python build and can be PEERDIR-ed from PY2_LIBRARY and alikes.
  7241. ### Proper version will be selected according to Python version of the module PEERDIR comes from.
  7242. ###
  7243. ### This mulrtimodule doesn't define any final targets so cannot be used from DEPENDS or BUNDLE macros.
  7244. ###
  7245. ### For more information read https://wiki.yandex-team.ru/arcadia/python/pysrcs/#pysrcssrcsipy23nativelibrary
  7246. ###
  7247. ### @see [LIBRARY()](#module_LIBRARY), [PY2MODULE()](#module_PY2MODULE)
  7248. multimodule PY23_NATIVE_LIBRARY {
  7249. module PY2: LIBRARY {
  7250. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 PYTHON3_ADDINCL RUN_ANTLR4_PYTHON
  7251. OBJ_SUF=.py2
  7252. PYTHON2_ADDINCL()
  7253. SET(MODULE_LANG PY2)
  7254. }
  7255. module PY3: LIBRARY {
  7256. .RESTRICTED=PY_SRCS USE_PYTHON2 USE_PYTHON3 RUN_ANTLR4_PYTHON
  7257. .ALIASES=PYTHON2_ADDINCL=PYTHON3_ADDINCL
  7258. .SEM=CPP_LIBRARY_SEM
  7259. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  7260. PYTHON3_ADDINCL()
  7261. SET(MODULE_LANG PY3)
  7262. when ($MSVC == "yes" || $CYGWIN == "yes") {
  7263. MODULE_PREFIX=py3c
  7264. }
  7265. otherwise {
  7266. MODULE_PREFIX=libpy3c
  7267. }
  7268. OBJ_SUF=.py3
  7269. }
  7270. }
  7271. IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  7272. # tag:src-processing
  7273. STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text
  7274. macro _SRC("storyboard", SRC, SRCFLAGS...) {
  7275. .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}
  7276. }
  7277. # tag:src-processing
  7278. macro _SRC("xib", SRC, SRCFLAGS...) {
  7279. .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}
  7280. }
  7281. ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  7282. # tag:ios-specific
  7283. ASSETS_FLAGS=--output-format human-readable-text --notices --warnings
  7284. macro _IOS_ASSETS(AssetsDir, Content...) {
  7285. .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
  7286. }
  7287. # tag:ios-specific
  7288. macro IOS_APP_COMMON_FLAGS(Flags...) {
  7289. SET_APPEND(STORYBOARD_FLAGS $Flags)
  7290. SET_APPEND(ASSETS_FLAGS $Flags)
  7291. }
  7292. # tag:ios-specific
  7293. macro IOS_APP_ASSETS_FLAGS(Flags...) {
  7294. SET_APPEND(ASSETS_FLAGS $Flags)
  7295. }
  7296. macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) {
  7297. .CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR
  7298. }
  7299. macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) {
  7300. .CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR
  7301. }
  7302. # tag:ios-specific
  7303. DELIM=__DELIM__
  7304. 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
  7305. ### @usage: IOS_INTERFACE()
  7306. ### iOS GUI module definition
  7307. module IOS_INTERFACE: _BARE_UNIT {
  7308. .CMD=PACK_IOS_ARCHIVE
  7309. .EXTS=.compiled_storyboard_tar .partial_plist .plist .xcent .nib .resource_tar .signed_resource_tar .strings_tar .plist_json
  7310. .NODE_TYPE=Library
  7311. .FINAL_TARGET=no
  7312. SET(MODULE_SUFFIX .ios.interface)
  7313. PEERDIR+=build/platform/xcode/tools
  7314. }
  7315. # tag:ios-specific
  7316. module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
  7317. SET(MODULE_SUFFIX .default.ios.interface)
  7318. }
  7319. DEFAULT_IOS_TYPE=
  7320. IOS_TYPE=
  7321. when(!$IOS_TYPE) {
  7322. when($DEFAULT_IOS_TYPE) {
  7323. IOS_TYPE=$DEFAULT_IOS_TYPE
  7324. }
  7325. otherwise {
  7326. IOS_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-X
  7327. }
  7328. }
  7329. DEFAULT_IOS_RUNTIME=
  7330. IOS_RUNTIME=
  7331. when(!$IOS_RUNTIME) {
  7332. when($DEFAULT_IOS_RUNTIME) {
  7333. IOS_RUNTIME=$DEFAULT_IOS_RUNTIME
  7334. }
  7335. otherwise {
  7336. IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-1
  7337. }
  7338. }
  7339. when ($ARCH_I386) {
  7340. TEST_IOS_DEVICE_TYPE_VALUE=com.apple.CoreSimulator.SimDeviceType.iPhone-5
  7341. TEST_IOS_RUNTIME_TYPE_VALUE=com.apple.CoreSimulator.SimRuntime.iOS-10-3
  7342. }
  7343. otherwise {
  7344. TEST_IOS_DEVICE_TYPE_VALUE=$IOS_TYPE
  7345. TEST_IOS_RUNTIME_TYPE_VALUE=$IOS_RUNTIME
  7346. }
  7347. # tag:java-specific
  7348. ### @usage: JDK_VERSION(Version)
  7349. ###
  7350. ### Specify JDK version for module
  7351. macro JDK_VERSION(Arg) {
  7352. .SEM=required_jdk $Arg ${output;hide:"JdkVersionFakeProp.java"}
  7353. SET(JDK_REAL_VERSION $Arg)
  7354. _JDK_VERSION_MACRO_CHECK($Arg)
  7355. }
  7356. # tag:java-specific
  7357. when ($JDK_REAL_VERSION == "10") {
  7358. JDK10=yes # remove this later
  7359. }
  7360. JAVA_PROGRAM_CP_USE_COMMAND_FILE=yes
  7361. when ($JDK_REAL_VERSION == "8") {
  7362. JAVA_PROGRAM_CP_USE_COMMAND_FILE=no
  7363. }
  7364. # tag:kotlin-specific
  7365. KOTLIN_JVM_TARGET=
  7366. when ($JDK_REAL_VERSION == "8") {
  7367. KOTLIN_JVM_TARGET=1.8
  7368. }
  7369. elsewhen ($JDK_REAL_VERSION == "20") {
  7370. # remove when kotlin starts supporting jdk20 bytecode
  7371. # see also devtools/ya/jbuild/gen/actions/idea.py
  7372. KOTLIN_JVM_TARGET=19
  7373. }
  7374. otherwise {
  7375. KOTLIN_JVM_TARGET=$JDK_REAL_VERSION
  7376. }
  7377. # tag:frontend-specific
  7378. ### @usage: COLLECT_FRONTEND_FILES(Varname, Dir)
  7379. ###
  7380. ### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname
  7381. macro COLLECT_FRONTEND_FILES(Varname, Dir) {
  7382. _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html))
  7383. }
  7384. # tag:java-specific
  7385. # local jdk and tools
  7386. USE_SYSTEM_JDK=
  7387. USE_SYSTEM_UBERJAR=
  7388. USE_SYSTEM_ERROR_PRONE=
  7389. # tag:swift-specific
  7390. CPP_XCODE_TOOLCHAIN_VERSION=9.2
  7391. SWIFT_XCODE_TOOLCHAIN_VERSION=9.2
  7392. XCODE_TOOLS_VERSION=10.1
  7393. macro COMPILE_SWIFT_MODULE(SRCS{input}[], BRIDGE_HEADER{input}="", Flags...) {
  7394. when ($BRIDGE_HEADER != "") {
  7395. SWIFT_BRIDGE_HEADER=-import-objc-header ${input:BRIDGE_HEADER}
  7396. }
  7397. otherwise {
  7398. SWIFT_BRIDGE_HEADER=
  7399. }
  7400. .PEERDIR+=build/platform/xcode/swift
  7401. # swift core libraries
  7402. LDFLAGS($SWIFT_LD_FLAGS)
  7403. .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}
  7404. }
  7405. TEST_TOOL_HOST_LOCAL=
  7406. TEST_TOOL_TARGET_LOCAL=
  7407. when ($MOST_USED_CUDA) {
  7408. CUDA_VERSION=11.4
  7409. CUDNN_VERSION=8.0.5
  7410. TENSORRT_VERSION=7
  7411. }
  7412. when ($TENSORFLOW_WITH_CUDA) {
  7413. CUDA_REQUIRED=yes
  7414. }
  7415. when (!$TENSORRT_VERSION) {
  7416. TENSORRT_VERSION=5
  7417. }
  7418. ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
  7419. MAVEN_BIN=$MAVEN_RESOURCE_GLOBAL/bin/mvn
  7420. when ($QT_REQUIRED) {
  7421. QT_BIN=${HOST_QT_RESOURCE_GLOBAL}/bin
  7422. }
  7423. when ($OPENGL_REQUIRED) {
  7424. OPENGL_VERSION=18.0.5
  7425. }
  7426. # tag:python-specific
  7427. multimodule PY23_TEST {
  7428. module PY2 : PYTEST_BIN {
  7429. .RESTRICTED=RUN_ANTLR4_PYTHON
  7430. MODULE_PREFIX=py2_
  7431. OBJ_SUF=.py2
  7432. CANONIZE_SUB_PATH=py2test
  7433. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  7434. }
  7435. module PY3TEST_PROGRAM: PY3TEST_BIN {
  7436. .FINAL_TARGET=yes
  7437. .RESTRICTED=RUN_ANTLR4_PYTHON
  7438. OBJ_SUF=.py3
  7439. CANONIZE_SUB_PATH=py3test
  7440. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  7441. }
  7442. module PY3TEST_LIBRARY: PY3_LIBRARY {
  7443. .RESTRICTED=RUN_ANTLR4_PYTHON
  7444. PEERDIR+=library/python/pytest
  7445. _REQUIRE_EXPLICIT_LICENSE()
  7446. RUN_CYTHON_SCRIPT_H=$YMAKE_PYTHON $CYTHON_SCRIPT
  7447. }
  7448. }
  7449. # tag:windows-specific
  7450. WINDOWS_MANIFEST=
  7451. macro WINDOWS_MANIFEST(Manifest) {
  7452. SET(WINDOWS_MANIFEST $Manifest)
  7453. }
  7454. # https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation#enable-long-paths-in-windows-10-version-1607-and-later
  7455. macro WINDOWS_LONG_PATH_MANIFEST() {
  7456. SET(WINDOWS_MANIFEST build/long-path.manifest)
  7457. }
  7458. # tag:windows-specific
  7459. when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
  7460. LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
  7461. }
  7462. # tag:cpp-specific
  7463. _VISIBILITY_LEVEL=
  7464. ### @usage: VISIBILITY(level)
  7465. ###
  7466. ### This macro sets visibility level for symbols compiled for the current module. 'level'
  7467. ### may take only one of the following values: DEFAULT, HIDDEN.
  7468. macro VISIBILITY(LEVEL) {
  7469. SET(_VISIBILITY_LEVEL ${LEVEL})
  7470. select ($LEVEL) {
  7471. "DEFAULT" | "HIDDEN" ? {
  7472. }
  7473. default ? {
  7474. _OK = no
  7475. }
  7476. }
  7477. ASSERT(_OK Unsupported value [$LEVEL] passed to VISIBILITY macro, expected values are DEFAULT, HIDDEN.)
  7478. }
  7479. # tag:cpp-specific
  7480. _CFLAGS_VISIBILITY=
  7481. when ($_VISIBILITY_LEVEL != "" && $IGNORE_VISIBILITY != "yes") {
  7482. when ($CLANG == "yes" || $GCC == "yes") {
  7483. _CFLAGS_VISIBILITY=-fvisibility=${tolower:_VISIBILITY_LEVEL}
  7484. }
  7485. }
  7486. CFLAGS+=$_CFLAGS_VISIBILITY
  7487. # tag:cpp-specific
  7488. macro SDBUS_CPP_ADAPTOR(File) {
  7489. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --adaptor=${output;nopath;noext:File.adaptor.h} ${input:File}
  7490. .PEERDIR=contrib/libs/sdbus-cpp
  7491. }
  7492. # tag:cpp-specific
  7493. macro SDBUS_CPP_PROXY(File) {
  7494. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --proxy=${output;nopath;noext:File.proxy.h} ${input:File}
  7495. .PEERDIR=contrib/libs/sdbus-cpp
  7496. }
  7497. # tag:python-specific
  7498. macro _PY_ENUM_SERIALIZATION_TO_JSON(File) {
  7499. .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"}
  7500. }
  7501. # tag:python-specific
  7502. macro _PY_ENUM_SERIALIZATION_TO_PY(File) {
  7503. .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"}
  7504. }
  7505. macro NGINX_MODULES(Modules...) {
  7506. PEERDIR(${Modules})
  7507. 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)
  7508. }
  7509. # tag:external-build
  7510. CONTAINER_LAYER_CMD=$YMAKE_PYTHON ${input:"build/scripts/make_container_layer.py"} -s $SQUASHFS_RESOURCE_GLOBAL -o $TARGET $AUTO_INPUT ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CL"} ${kv;hide:"pc blue"}
  7511. CONTAINER_CMD=$YMAKE_PYTHON ${input:"build/scripts/make_container.py"} -s $SQUASHFS_RESOURCE_GLOBAL -o $TARGET ${rootrel:PEERS} ${cwd:ARCADIA_BUILD_ROOT} ${kv;hide:"p CN"} ${kv;hide:"pc blue"}
  7512. # tag:external-build
  7513. module CONTAINER_LAYER: _BARE_UNIT {
  7514. .CMD=CONTAINER_LAYER_CMD
  7515. PEERDIR(build/external_resources/squashfs_tools)
  7516. MODULE_SUFFIX=.container_layer
  7517. CHECK_ALLOWED_PATH()
  7518. CHECK_DEPENDENT_DIRS(ALLOW_ONLY PEERDIRS base_layers build/external_resources/squashfs_tools build/platform/python/ymake_python3 junk)
  7519. }
  7520. # tag:external-build
  7521. module CONTAINER: _BARE_UNIT {
  7522. .NODE_TYPE=Bundle
  7523. .PEERDIR_POLICY=as_build_from
  7524. .FINAL_TARGET=yes
  7525. .CMD=CONTAINER_CMD
  7526. PEERDIR(build/external_resources/squashfs_tools)
  7527. PEERDIR(devtools/contrib/cake/entry)
  7528. }
  7529. # tag:external-build
  7530. CUSTOM_BUILD_LIBRARY_USE=
  7531. CUSTOM_BUILD_LIBRARY_CMD=$GENERATE_MF && ${tool:"devtools/experimental/solar/outbuild/runner"} ${hide:PEERS} --script=${input:CUSTOM_SCRIPT} --output $TARGET --python=${tool:"contrib/tools/python3"} --isolator=${tool:"devtools/experimental/solar/outbuild/isolator"} $CUSTOM_BUILD_LIBRARY_USE
  7532. # tag:external-build
  7533. module CUSTOM_BUILD_LIBRARY: LIBRARY {
  7534. .NODE_TYPE=Bundle
  7535. .PEERDIR_POLICY=as_build_from
  7536. .PROXY=yes
  7537. .CMD=CUSTOM_BUILD_LIBRARY_CMD
  7538. DISABLE(NEED_ADD_FAKE_SRC)
  7539. }
  7540. ### @usage: ORIGINAL_SOURCE(Source)
  7541. ###
  7542. ### This macro specifies the source repository for contrib
  7543. ### Does nothing now (just a placeholder for future functionality)
  7544. ### See https://st.yandex-team.ru/DTCC-316
  7545. macro ORIGINAL_SOURCE(Source) {
  7546. ENABLE(UNUSED_MACRO)
  7547. }
  7548. # tag:licence
  7549. CREDITS_FILE_EXTRA_EXT=
  7550. CREDITS_FLAGS=
  7551. CREDITS_TEXTS_FILE=
  7552. NO_CREDITS_TEXTS_FILE=
  7553. WITH_CREDITS=
  7554. ### @usage: LICENSE_TEXTS(File)
  7555. ###
  7556. ### This macro specifies the filename with all library licenses texts
  7557. macro LICENSE_TEXTS(Source) {
  7558. SET(CREDITS_TEXTS_FILE $Source)
  7559. }
  7560. # tag:licence
  7561. ### @usage: WITHOUT_LICENSE_TEXTS()
  7562. ###
  7563. ### This macro indicates that the module has no license text
  7564. macro WITHOUT_LICENSE_TEXTS() {
  7565. ENABLE(NO_CREDITS_TEXTS_FILE)
  7566. }
  7567. # tag:licence
  7568. when ($WITH_CREDITS) {
  7569. CREDITS_FLAGS+=--credits-output ${output;suf=${CREDITS_FILE_EXTRA_EXT}".CREDITS.txt":REALPRJNAME}
  7570. }
  7571. GENERATE_MF=
  7572. when ($WITH_CREDITS) {
  7573. GENERATE_MF=$GENERATE_MF_CMD
  7574. }
  7575. macro _MCU_CONVERT(Bin) {
  7576. .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}
  7577. }
  7578. MCU_LINK_EXE=$LINK_EXE && $_MCU_CONVERT($MODULE_PREFIX$REALPRJNAME)
  7579. ### @usage: MCU_PROGRAM([progname])
  7580. ###
  7581. ### Program module for microcontrollers. Converts ELF to Intel HEX, Motorola S-record and raw binary file formats.
  7582. ### If name is not specified it will be generated from the name of the containing project directory.
  7583. module MCU_PROGRAM: PROGRAM {
  7584. .CMD=MCU_LINK_EXE
  7585. }
  7586. @import "${CONF_ROOT}/conf/project_specific/esp.conf"
  7587. # tag:flags tag:internal tag:windows-specific
  7588. ### @usage: _MSVC_FLAGS_WINDOWS_IMPL(target_platform compiler_flags) # internal
  7589. ###
  7590. ### Add CFLAGS when the firts argument is WINDOWS
  7591. macro _MSVC_FLAGS_WINDOWS_IMPL(WINDOWS[], FLAGS...) {
  7592. CFLAGS($WINDOWS)
  7593. }
  7594. # tag:flags tag:windows-specific tag:cpp-specific
  7595. ### @usage: MSVC_FLAGS([GLOBAL compiler_flag]* compiler_flags)
  7596. ###
  7597. ### Add the specified flags to the compilation line of C/C++files.
  7598. ### Flags apply only if the compiler used is MSVC (cl.exe)
  7599. macro MSVC_FLAGS(FLAGS...) {
  7600. _MSVC_FLAGS_WINDOWS_IMPL($TARGET_PLATFORM $FLAGS)
  7601. }
  7602. ### @usage: COLLECT_YDB_API_SPECS_LEGACY(VarName Paths...) #deprecated
  7603. ###
  7604. ### This macro is ugly hack for legacy YDB go API codegen, any other uses are prohibited
  7605. macro COLLECT_YDB_API_SPECS_LEGACY(FILES_VAR, PATHS...) {
  7606. _GLOB($FILES_VAR ${suf=/*.proto:PATHS})
  7607. RESTRICT_PATH(kikimr/public/sdk/go/ydb/api MSG This is ugly hack for legacy YDB go API codegen, any other uses are probibited)
  7608. }
  7609. # tag:proto tag:apphost
  7610. ### @usage: APPHOST()
  7611. ###
  7612. ### Emit APPHOST service code for all .proto files in a PROTO_LIBRARY.
  7613. ### This works only for C++ and Java at the moment.
  7614. macro APPHOST() {
  7615. # C++
  7616. CPP_PROTO_PLUGIN(cpp_plugin apphost/tools/stub_generator/cpp_plugin .apphost.h DEPS apphost/tools/stub_generator/cpp_includes)
  7617. # Java
  7618. JAVA_PROTO_PLUGIN(java_plugin apphost/tools/stub_generator/java_plugin DEPS apphost/api/service/java/apphost)
  7619. }
  7620. # tag:internal
  7621. ### Add passed ya.conf.json and all bottle's formula external files to resources
  7622. ### File MUST be arcadia root relative path (without "${ARCADIA_ROOT}/" prefix).
  7623. ### NOTE:
  7624. ### An external formula file referenced from ya.conf.json must be passed as an arcadia root relative path and
  7625. ### should be located in any subdirectory of the ya.conf.json location ("build/" if we consider a production).
  7626. ### The later restriction prevents problems in selectively checkouted arcadia.
  7627. macro YA_CONF_JSON(File) {
  7628. _YA_CONF_JSON($File)
  7629. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/$File)
  7630. }
  7631. # tag:internal
  7632. # Don't use directly - wrap with custom macros
  7633. macro ADD_LINTER_CHECK(CheckName, Linter, DEPENDS[], EXCLUDE[], FILES[], CONFIGS[]) {
  7634. SET(_FILES_VAR uniq_${hash:VAR_SALT})
  7635. _GLOB($_FILES_VAR $FILES EXCLUDE $EXCLUDE)
  7636. _ADD_LINTER_CHECK($CheckName $Linter ${pre=DEPENDS :DEPENDS} FILES $$_FILES_VAR CONFIGS $CONFIGS)
  7637. }
  7638. # tag:internal
  7639. # Draft. Don't use.
  7640. macro _CPP_STYLE(EXCLUDE[], Files...) {
  7641. 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)
  7642. }
  7643. # tag:proto
  7644. macro ALICE_CAPABILITY() {
  7645. CPP_PROTO_PLUGIN(alice_capability_cpp yandex_io/tools/capability_gen .cap.h DEPS yandex_io/libs/protobuf_utils)
  7646. 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)
  7647. }