Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
69 changes: 69 additions & 0 deletions build_rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Check for linux vs macOS and account for clang/ld path
UNAME_S := $(shell uname -s)

ifeq ($(UNAME_S),Linux)
CC := clang
CXX := clang++
LD := ld.lld
AR := llvm-ar
CDIR := linux
endif
ifeq ($(UNAME_S),Darwin)
CC := /usr/local/opt/llvm/bin/clang
CXX := /usr/local/opt/llvm/bin/clang++
LD := /usr/local/opt/llvm/bin/ld.lld
AR := /usr/local/opt/llvm/bin/llvm-ar
CDIR := macos
endif

# Allow for 'make VERBOSE=1' to see the recepie executions
ifndef VERBOSE
VERB := @
endif

#---------------------------------------------------------------------------------
%.a:
#---------------------------------------------------------------------------------
$(VERB) echo $(notdir $@)
$(VERB) rm -f $@
$(VERB) $(AR) -rc $@ $^

#---------------------------------------------------------------------------------
%.elf: $(OFILES)
$(VERB) echo linking ... $(notdir $@)
$(VERB) $(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@

#---------------------------------------------------------------------------------
%.o: %.cpp
$(VERB) echo $(notdir $<)
$(VERB) $(CXX) $(DEPSOPT) $(CXXFLAGS) -o $@ $< $(ERROR_FILTER)

#---------------------------------------------------------------------------------
%.o: %.c
$(VERB) echo $(notdir $<)
$(VERB) $(CC) $(DEPSOPT) $(CFLAGS) -o $@ $< $(ERROR_FILTER)

#---------------------------------------------------------------------------------
%.o: %.m
$(VERB) echo $(notdir $<)
$(VERB) $(CC) $(DEPSOPT) $(OBJCFLAGS) -o $@ $< $(ERROR_FILTER)

#---------------------------------------------------------------------------------
%.o: %.s
$(VERB) echo $(notdir $<)
$(VERB) $(CC) $(DEPSOPT) -x assembler-with-cpp $(ASFLAGS) -o $@ $< $(ERROR_FILTER)

#---------------------------------------------------------------------------------
%.o: %.S
$(VERB) echo $(notdir $<)
$(VERB) $(CC) $(DEPSOPT) -x assembler-with-cpp $(ASFLAGS) -o $@ $< $(ERROR_FILTER)

#---------------------------------------------------------------------------------
# canned command sequence for binary data
#---------------------------------------------------------------------------------
define bin2o
$(VERB) bin2s -a 64 $< | $(AS) -o $(@)
$(VERB) echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
$(VERB) echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
$(VERB) echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
endef
Loading