Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildsystem: keep subfolders of sources unique #21121

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.base
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ ifneq (,$(SUBDIRS_IN_DIRS))
$(patsubst $(CURDIR)/%,./%, $(SUBDIRS_IN_DIRS)). \
Please select a single approach for each subfolder to prevent linking errors.)
endif
SUBDIRS := $(filter-out $(BINDIR)/$(MODULE)/, $(dir $(OBJ)))
SUBDIRS := $(sort $(filter-out $(BINDIR)/$(MODULE)/, $(dir $(OBJ))))

include $(RIOTMAKE)/blob.inc.mk
include $(RIOTMAKE)/tools/fixdep.inc.mk
Expand Down
2 changes: 1 addition & 1 deletion examples/subfolders/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ USEMODULE += my_module # name as defined in module/Makefile

# Add source files in subfolders manually
SRC += main.c
SRC += folder/a.c folder/subfolder/b.c
SRC += folder/a.c folder/subfolder/b.c folder/subfolder/c.c

# Alternative method to add files in subfolders using wildcards
# SRC += $(wildcard *.c folder/*.c folder/**/*.c)
Expand Down
14 changes: 14 additions & 0 deletions examples/subfolders/folder/subfolder/c.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (C) 2025 ML!PA Consulting GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

#include <stdio.h>

void folder_c(void)
{
puts("./folder/subfolder/c.c");
}
2 changes: 2 additions & 0 deletions examples/subfolders/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ void module_a(void);
void module_b(void);
void folder_a(void);
void folder_b(void);
void folder_c(void);

int main(void)
{
Expand All @@ -34,6 +35,7 @@ int main(void)
// call functions from subfolder
folder_a();
folder_b();
folder_c();

return 0;
}
Loading