普通网友 2016-03-04 22:51
浏览 109
已采纳

部分重用的makefile的模式

I am at this time creating more and more of small one-off projects in golang but I see many makefile tasks are literally copy&paste from across projects. For example, in every project I have a:

${APP_NAME}: $(SOURCES)
    go get ./...
    goimports -w $(SOURCES)
    go build -o ${APP_NAME}

I would like to know if anyone has experience of fragment extraction into a separate project and importing it. If so, how do you do it?

  • Just curl a file from raw.githubusercontent.com? Because that's what I'm about to do since I don't see any other easy way.

  • I also thought about using git submodules but that seems also a bit over the top for a couple of files.

  • 写回答

1条回答 默认 最新

  • douzhi2017 2016-03-27 00:08
    关注

    I have found a simple workaround: I include Makefiles which I made from the starting monolithic Makefile.

    I am putting split Makefiles in a separate git project, that contains only them.

    I am referring to those Makefiles from root project and I have them locally via git submodule. A bit more work - yes, but it allows me to have trivial "root" Makefile and all hard (quite often - repeating) logic in the separate project.

    Example of how I made this work:

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 来个会搭建付费网站的有偿
  • ¥100 有能够实现人机模式的c/c++代码,有图片背景等,能够直接进行游戏
  • ¥20 校园网认证openwrt插件
  • ¥15 以AT89C51单片机芯片为核心来制作一个简易计算器,外部由4*4矩阵键盘和一个LCD1602字符型液晶显示屏构成,内部由一块AT89C51单片机构成,通过软件编程可实现简单加减乘除。
  • ¥15 求GCMS辅导数据分析
  • ¥30 SD中的一段Unet下采样代码其中的resnet是谁跟谁进行残差连接
  • ¥15 Unet采样阶段的res_samples问题
  • ¥60 Python+pygame坦克大战游戏开发实验报告
  • ¥15 R语言regionNames()和demomap()无法选中中文地区的问题
  • ¥15 Open GL ES 的使用
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部