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 725129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:18:08+00:00 2026-05-14T06:18:08+00:00

My project (an interpreted language) has a standard library composed by multiple files, each

  • 0

My project (an interpreted language) has a standard library composed by multiple files, each of them will be built into an .so dynamic library that the interpreter will load upon user request (with an import directive).
Each source file is located into a subdirectory representing its “namespace”, for instance :

libraries tree

The build process has to create a “build” directory, then when each file is compiling has to create its namespace directory inside the “build” one, for instance, when compiling

std/io/network/tcp.cc

he run an mkdir command with

mkdir -p build/std/io/network

The Makefile snippet is :

STDSRC=stdlib/std/hashing/md5.cc \
       stdlib/std/hashing/crc32.cc \
       stdlib/std/hashing/sha1.cc \
       stdlib/std/hashing/sha2.cc \
       stdlib/std/io/network/http.cc \
       stdlib/std/io/network/tcp.cc \
       stdlib/std/io/network/smtp.cc \
       stdlib/std/io/file.cc \
       stdlib/std/io/console.cc \
       stdlib/std/io/xml.cc \
       stdlib/std/type/reflection.cc \
       stdlib/std/type/string.cc \
       stdlib/std/type/matrix.cc \
       stdlib/std/type/array.cc \
       stdlib/std/type/map.cc \
       stdlib/std/type/type.cc \
       stdlib/std/type/binary.cc \
       stdlib/std/encoding.cc \
       stdlib/std/os/dll.cc \
       stdlib/std/os/time.cc \
       stdlib/std/os/threads.cc \
       stdlib/std/os/process.cc \
       stdlib/std/pcre.cc \
       stdlib/std/math.cc

STDOBJ=$(STDSRC:.cc=.so)

all: stdlib

stdlib: $(STDOBJ)

.cc.so: 
    mkdir -p `dirname $< | sed -e 's/stdlib/stdlib\/build/'`
    $(CXX) $< -o `dirname $< | sed -e 's/stdlib/stdlib\/build/'`/`basename $< .cc`.so $(CFLAGS) $(LDFLAGS)

I have two questions :

1 – The problem is that the make command, i really don’t know why, doesn’t check if a file was modified and launch the build process on ALL the files no matter what, so if i need to build only one file, i have to build them all or use the command :

make path/to/single/file.so

Is there any way to solve this?

2 – Any way to do this in a “cleaner” way without have to distribute all the build directories with sources?

Thanks

  • 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-05-14T06:18:08+00:00Added an answer on May 14, 2026 at 6:18 am

    For 1) the problem is that the target of your rule (stdlib/something.so) is not exactly what the rule makes (build/something.so), so Make always thinks it must make the target. This should fix it (I am using GNUMake):

    STDOBJ=$(patsubst stdlib%.cc,build%.so, $(STDSRC))
    
    all: stdlib
    
    stdlib: $(STDOBJ)
    
    build/%.so: stdlib/%.cc
        mkdir -p $(dir $@)
        $(CXX) $< -o $@ $(CFLAGS) $(LDFLAGS)
    

    For 2) I’m not sure what you mean. If you want the build directory structure you describe, this will do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 476k
  • Answers 476k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you call array_values on your array, it will be… May 16, 2026 at 4:53 am
  • Editorial Team
    Editorial Team added an answer You will need to call update(Graphics g) on Panel after… May 16, 2026 at 4:53 am
  • Editorial Team
    Editorial Team added an answer What do you mean by "business logic"? I've seen cases… May 16, 2026 at 4:53 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.