Skip to content

Commit

Permalink
Fix automatic build process (#12) and extra docs
Browse files Browse the repository at this point in the history
* Fix automatic build process
* missed a hotlink
* Add discord for ways to contact us
  • Loading branch information
edjubuh authored Jun 22, 2017
1 parent f0f3fa6 commit 1f46578
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ include/*.h.gch
.gcc-flags.json
.project
.cproject
template/template.pros
template/src/*
!template/src/Makefile
template/include
template/firmware
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ library: clean $(BINDIR) $(SUBDIRS) $(ASMOBJ) $(COBJ) $(CPPOBJ)
TEMPLATEFILES:=src/auto.c src/init.c src/opcontrol.c include/API.h include/main.h firmware
template: library
-rm -rf $(addprefix $(ROOT)/template/,$(TEMPLATEFILES))
mkdir -p $(ROOT)/template/src $(ROOT)/template/inlcude $(ROOT)/template/firmware
mkdir -p $(ROOT)/template/src $(ROOT)/template/include $(ROOT)/template/firmware
$(foreach f,$(TEMPLATEFILES),cp -r $(ROOT)/$(f) $(ROOT)/template/$(f); )
cp $(BINDIR)/$(LIBNAME).a $(ROOT)/template/firmware/$(LIBNAME).a
pros conduct create-template kernel $(VERSION) pros-mainline --location $(ROOT)/template -u "firmware/$(LIBNAME).a" -u "include/API.h" -u "common.mk" -i "template.pros"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ We have a number of resources available on our website, including
Drop us a line
- at [email protected]
- on the [VEX Forum](https://www.vexforum.com/index.php/)
- on VEX Teams of the World Discord

### I think I found a bug!
We maintain GitHub repositories for the three major components of the PROS ecosystem:
- The Command Line Interface (cli) at [purduesigbots/pros-cli](github.com/purduesigbots/pros-cli)
- The Atom plugin at [purduesigbots/pros-atom](github.com/purduesigbots/pros-atom)
- The kernel [here](github.com/purduesigbots/pros)

If you find a problem with our documentation or tutorials, we have a repository for that, too, at [purduesigbots/pros-docs](github.com/purduesigbots/pros-docs).
If you find a problem with our documentation or tutorials, we have a repository for that, too, at purduesigbots/pros-docs.
42 changes: 29 additions & 13 deletions template/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Universal C Makefile for MCU targets

# Path to project root (NO trailing slash!)
ROOT=..
# 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=
SUBDIRS=src

# Nothing below here needs to be modified by typical users

Expand All @@ -21,32 +21,48 @@ CPPSRC:=$(wildcard *.$(CPPEXT))
CPPOBJ:=$(patsubst %.o,$(BINDIR)/%.o,$(CPPSRC:.$(CPPEXT)=.o))
OUT:=$(BINDIR)/$(OUTNAME)

.PHONY: all do_subdirs _force_look
.PHONY: all clean upload _force_look

# By default, compile program
all: do_subdirs .
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

# Compiles the program if anything is changed
.: $(SUBDIRS) $(ASMOBJ) $(COBJ) $(CPPOBJ)
@touch .
# Looks in subdirectories for things to make
$(SUBDIRS): %: _force_look
@$(MAKE) --no-print-directory -C $@

# Ensure binary directory exists
$(BINDIR):
-@mkdir -p $(BINDIR)

# Builds the subdirectories
do_subdirs: _force_look
@for dir in $(SUBDIRS); do $(MAKE) --no-print-directory -C $$dir || exit 1; done
# 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)
$(ASMOBJ): $(BINDIR)/%.o: %.$(ASMEXT) $(HEADERS)
@echo AS $<
@$(AS) $(AFLAGS) -o $@ $<

# Object management
$(COBJ): $(BINDIR)/%.o: %.$(CEXT) $(HEADERS)
@echo CC $(INCLUDE) $<
@$(CC) $(INCLUDE) $(CFLAGS) -o $@ $<
$(CC) $(INCLUDE) $(CFLAGS) -o $@ $<

$(CPPOBJ): $(BINDIR)/%.o: %.$(CPPEXT) $(HEADERS)
@echo CPC $(INCLUDE) $<
Expand Down
50 changes: 50 additions & 0 deletions template/src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Makefile for compiling PROS projects

# Path to project root (NO trailing slash!)
ROOT=..
# Binary output directory
BINDIR=$(ROOT)/bin

# 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))
### Special section for Cortex projects ###
HEADERS_2:=$(wildcard ../include/*.$(HEXT))
### End special section ###
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

# By default, compile program
all: .

# Compiles the program if anything is changed
.: $(ASMOBJ) $(COBJ) $(CPPOBJ)
@touch .

# Assembly source file management
$(ASMOBJ): $(BINDIR)/%.o: %.$(ASMEXT)
@echo AS $<
@$(AS) $(AFLAGS) -o $@ $<

### Special section for Cortex projects ###

# Object management
$(COBJ): $(BINDIR)/%.o: %.$(CEXT) $(HEADERS) $(HEADERS_2)
@echo CC $(INCLUDE) $<
@$(CC) $(INCLUDE) $(CFLAGS) -o $@ $<

$(CPPOBJ): $(BINDIR)/%.o: %.$(CPPEXT) $(HEADERS) $(HEADERS_2)
@echo CPC $(INCLUDE) $<
@$(CPPCC) $(INCLUDE) $(CPPFLAGS) -o $@ $<

### End special section ###

0 comments on commit 1f46578

Please sign in to comment.