Good morning PROS enthusiasts,
I’ve been struggling with something very strange recently and wanted to reach out for help.
Here’s the thing:
I wanted to organize my PROS files directories by putting individual “.c” and “.h” files into folders.
Sort of like this -
src
Functions (Folder)
Functions
As you can see, the “.c” files are inside of the source folder while also being apart of the Functions folder.
This should work and would also keep the program very organized, but the compiler goes haywire and doesn’t even touch the files in folders.
If there is a work around to this issue, I would love to hear it!
Cheers,
Subfolders need to have their own Makefile
, but it’s pretty easy. For example, look at my StarStruck Code on Github. It has a subfolder called utility
, with a Makefile
brendanmcguire:
Subfolders need to have their own Makefile
, but it’s pretty easy. For example, look at my StarStruck Code on Github. It has a subfolder called utility
, with a Makefile
Thank you very much! I will look into it.
Marking as resolved.
Contact the PROS team for more information. They are active on Discord, and generally respond pretty quick here too
What have I done? @brendanmcguire
make[1]: Nothing to be done for `all’.
make[1]: *** No targets specified and no makefile found. Stop
Could you give me the full stdout/stderr, as well as the command you ran?
No idea what those things mean. stdout and stderr?
My source file has the following folders:
bodilyFuncs
lcd
userFiles
recording.c, auton.c, opctrl.c
prosFiles
created_opctrl.c, created_auton.c, created created_init.c
My makefile in my root folder was:
# Universal C Makefile for MCU targets
# Path to project root (for top-level, so the project is in ./; first-level, ../; etc.)
ROOT=.
# Binary output directory
BINDIR=$(ROOT)/bin
# Subdirectories to include in the build
SUBDIRS=src src/bodilyFuncs src/prosFiles src/userFiles src/lcd
# Nothing below here needs to be modified by typical users
# Include common aspects of this project
-include $(ROOT)/common.mk
ASMSRC:=$(wildcard *.$(ASMEXT))
ASMOBJ:=$(patsubst %.o,$(BINDIR)/%.o,$(ASMSRC:.$(ASMEXT)=.o))
HEADERS:=$(wildcard *.$(HEXT))
CSRC=$(wildcard *.$(CEXT))
COBJ:=$(patsubst %.o,$(BINDIR)/%.o,$(CSRC:.$(CEXT)=.o))
CPPSRC:=$(wildcard *.$(CPPEXT))
CPPOBJ:=$(patsubst %.o,$(BINDIR)/%.o,$(CPPSRC:.$(CPPEXT)=.o))
OUT:=$(BINDIR)/$(OUTNAME)
.PHONY: all clean upload _force_look
# By default, compile program
all: $(BINDIR) $(OUT)
# Remove all intermediate object files (remove the binary directory)
clean:
-rm -f $(OUT)
-rm -rf $(BINDIR)
# Uploads program to device
upload: all
$(UPLOAD)
# Phony force-look target
_force_look:
@true
# Looks in subdirectories for things to make
$(SUBDIRS): %: _force_look
@$(MAKE) --no-print-directory -C $@
# Ensure binary directory exists
$(BINDIR):
-@mkdir -p $(BINDIR)
# Compile program
$(OUT): $(SUBDIRS) $(ASMOBJ) $(COBJ) $(CPPOBJ)
@echo LN $(BINDIR)/*.o $(LIBRARIES) to $@
@$(CC) $(LDFLAGS) $(BINDIR)/*.o $(LIBRARIES) -o $@
@$(MCUPREFIX)size $(SIZEFLAGS) $(OUT)
$(MCUPREPARE)
# Assembly source file management
$(ASMOBJ): $(BINDIR)/%.o: %.$(ASMEXT) $(HEADERS)
@echo AS $<
@$(AS) $(AFLAGS) -o $@ $<
# Object management
$(COBJ): $(BINDIR)/%.o: %.$(CEXT) $(HEADERS)
@echo CC $(INCLUDE) $<
$(CC) $(INCLUDE) $(CFLAGS) -o $@ $<
$(CPPOBJ): $(BINDIR)/%.o: %.$(CPPEXT) $(HEADERS)
@echo CPC $(INCLUDE) $<
@$(CPPCC) $(INCLUDE) $(CPPFLAGS) -o $@ $<
The other Makefile is default, located in the src folder. No modifications made to that.
I ran the regular make -ji command to make the file.
Hi Aditya, I’ll reply here and not through your email.
Copy the Makefile in src into your subdirectory bodilyFuncs (or whatever). Modify line 4 to go from:
ROOT=..
to
ROOT=../..
then, in the Makefile at the root directory, modify line 8 from:
SUBDIRS=src
to
SUBDIRS=src src/bodilyFuncs
And do the same thing for all your other directories.
No idea what those things mean. stdout and stderr?
My source file has the following folders:
bodilyFuncs
lcd
userFiles
recording.c, auton.c, opctrl.c
prosFiles
created_opctrl.c, created_auton.c, created created_init.c
My makefile in my root folder was:
# Universal C Makefile for MCU targets
# Path to project root (for top-level, so the project is in ./; first-level, ../; etc.)
ROOT=.
# Binary output directory
BINDIR=$(ROOT)/bin
# Subdirectories to include in the build
SUBDIRS=src src/bodilyFuncs src/prosFiles src/userFiles src/lcd
# Nothing below here needs to be modified by typical users
# Include common aspects of this project
-include $(ROOT)/common.mk
ASMSRC:=$(wildcard *.$(ASMEXT))
ASMOBJ:=$(patsubst %.o,$(BINDIR)/%.o,$(ASMSRC:.$(ASMEXT)=.o))
HEADERS:=$(wildcard *.$(HEXT))
CSRC=$(wildcard *.$(CEXT))
COBJ:=$(patsubst %.o,$(BINDIR)/%.o,$(CSRC:.$(CEXT)=.o))
CPPSRC:=$(wildcard *.$(CPPEXT))
CPPOBJ:=$(patsubst %.o,$(BINDIR)/%.o,$(CPPSRC:.$(CPPEXT)=.o))
OUT:=$(BINDIR)/$(OUTNAME)
.PHONY: all clean upload _force_look
# By default, compile program
all: $(BINDIR) $(OUT)
# Remove all intermediate object files (remove the binary directory)
clean:
-rm -f $(OUT)
-rm -rf $(BINDIR)
# Uploads program to device
upload: all
$(UPLOAD)
# Phony force-look target
_force_look:
@true
# Looks in subdirectories for things to make
$(SUBDIRS): %: _force_look
@$(MAKE) --no-print-directory -C $@
# Ensure binary directory exists
$(BINDIR):
-@mkdir -p $(BINDIR)
# Compile program
$(OUT): $(SUBDIRS) $(ASMOBJ) $(COBJ) $(CPPOBJ)
@echo LN $(BINDIR)/*.o $(LIBRARIES) to $@
@$(CC) $(LDFLAGS) $(BINDIR)/*.o $(LIBRARIES) -o $@
@$(MCUPREFIX)size $(SIZEFLAGS) $(OUT)
$(MCUPREPARE)
# Assembly source file management
$(ASMOBJ): $(BINDIR)/%.o: %.$(ASMEXT) $(HEADERS)
@echo AS $<
@$(AS) $(AFLAGS) -o $@ $<
# Object management
$(COBJ): $(BINDIR)/%.o: %.$(CEXT) $(HEADERS)
@echo CC $(INCLUDE) $<
$(CC) $(INCLUDE) $(CFLAGS) -o $@ $<
$(CPPOBJ): $(BINDIR)/%.o: %.$(CPPEXT) $(HEADERS)
@echo CPC $(INCLUDE) $<
@$(CPPCC) $(INCLUDE) $(CPPFLAGS) -o $@ $<
The other Makefile is default, located in the src folder. No modifications made to that.
I ran the regular make -ji command to make the file.
Excuse me, STDOUT/STDERR means the exact output you get when you type the command
No worries. I’m just a dunce
edjubuh:
Hi Aditya, I’ll reply here and not through your email.
Copy the Makefile in src into your subdirectory bodilyFuncs (or whatever). Modify line 4 to go from:
ROOT=..
to
ROOT=../..
then, in the Makefile at the root directory, modify line 8 from:
SUBDIRS=src
to
SUBDIRS=src src/bodilyFuncs
And do the same thing for all your other directories.
Thank you for the run-down. I’ll make those changes and get back to you.
Hi, recently I meet the same problem with Makefile.
I not only want to solve this problem, but learn something about Makefile,
May I ask for some way to understand Makefile better?
Eden
July 18, 2019, 12:05pm
12
Does this error only happens with c files? or will cpp files in a sub folder also cause the error?
Barin
July 18, 2019, 9:02pm
13
For current and future readers, the Makefiles in the latest versions of PROS for Cortex and PROS for V5 support recursive search for source files and no modification needs to be made to make PROS compile subdirectories of the src folder (or subdirectories of subdirectories, etc.).
3 Likes