Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7962387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:19:23+00:00 2026-06-04T05:19:23+00:00

I have this Makefile that has a variables named MODULES which lists all the

  • 0

I have this Makefile that has a variables named “MODULES” which lists all the modules I have activated in my build.

This list is separated by spaces, so it looks like this when I do echo $(MODULES):

module1 module2 module3 module4 mod5 mod6 mod7 module8 module9

What I would like to do is present this list in some columns that would be displayed at compilation time.

Like this:

Modules activated:
module1 module2 module3 
module4 mod5    mod6 
mod7    module8 module9

Ideally, the column withs would adjust to the width of the largest module in the column (see mod7); and the number of columns would be adjusted according to the width of the current terminal.

Now, I found some unix utilities that seem to do that, like column, but I can’t make it work with my set.

Do you have some trick that would allow me to do that?

edit:

With the answer chosen below, I finally cracked this command in my Makefile:

@printf '%s\n' $(MODULES) | sort | column
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:19:25+00:00Added an answer on June 4, 2026 at 5:19 am
    printf '%-12s%-12s%s\n' $modules
    

    This consumes the contents of the variable for the number of times a placeholder appears in the format string and repeats until all the contents are consumed.

    The column utility will automatically produce columns for you:

    column <<< "$(printf '%s\n' $module)"
    

    That’s column-first. If you want row-first:

    column -x <<< "$(printf '%s\n' $module)"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this little code which lists all matches of items that contains the
I have a Makefile , that has variables version and build (those are not
I have a section of makefile that has this sort of structure: bob: ifdef
I have a Makefile that looks like this CXX = g++ -O2 -Wall all:
I have a Makefile that looks something like this: sometarget: command_one # calls fork()
I have a source directory which uses makefile to compile the code. This makefile/configure
I have this problem, in a form I have a list of customers that
I have a Makefile for a C program that has the declaration CC?=gcc Changing
I have a C project that has the following structure Main/ Makefile.am bin/ src/
Look at this makefile, it has some sort of primitive progress indication (could have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.