Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44 lines (32 sloc)
1.19 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UNAME_S := $(shell uname -s) | |
ifeq ($(UNAME_S),Darwin) | |
error: | |
@echo "Cannot compile on Mac OS X as Mac OS X cannot build ELF files. Please compile on Linux." | |
@echo "The resulting native modules can then be used under Mac OS X, too!" | |
endif | |
all: native.so | |
esp32: native.so | |
C = gcc | |
CXX = g++ | |
LD = ld | |
FLAGS = -O3 -fPIC -fvisibility=hidden -fno-stack-protector -fno-builtin | |
CFLAGS = $(FLAGS) -I../include | |
CXXFLAGS = $(FLAGS) -I../include | |
LDFLAGS = $(FLAGS) -shared -T ../ld/`uname -s`-`uname -m`.ld | |
esp32: C = ~/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc | |
esp32: CXX = ~/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ | |
esp32: LD = ~/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-ld | |
esp32: CFLAGS = $(FLAGS) -I../include -DDUK_F_32BIT_PTRS -mlongcalls -mfix-esp32-psram-cache-issue | |
esp32: CXXFLAGS = $(FLAGS) -I../include -DDUK_F_32BIT_PTRS -mlongcalls -mfix-esp32-psram-cache-issue | |
esp32: LDFLAGS = $(FLAGS) -shared -T ../ld/esp32.ld | |
OBJECTS = \ | |
native.o | |
clean: | |
rm -f native.so *.o *.d | |
native.so: $(OBJECTS) Makefile | |
$(LD) -o native.so $(OBJECTS) $(LDFLAGS) | |
%.o : %.c Makefile | |
$(C) $(CFLAGS) -MMD -o $@ -c $< | |
%.o : %.cpp Makefile | |
$(CXX) $(CXXFLAGS) -MMD -o $@ -c $< | |
-include $(OBJECTS:.o=.d) $(OBJECTS_LOW:.o=.d) |