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

support cross compiling #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/priv
erl_crash.dump
*.ez
/src/*.o
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
SRC=$(wildcard src/*.c)

CFLAGS += -std=c99 -D_GNU_SOURCE
CC ?= $(CROSSCOMPILER)gcc

UNAME := $(shell uname)

ifeq ($(UNAME),MSYS_NT-6.1)
Expand All @@ -8,11 +13,18 @@ else
SOURCES = src/baud-posix.c src/baud.c src/util.c src/loop.c
endif

OBJ=$(SOURCES:.c=.o)

.PHONY: all clean

all: $(TARGET)

$(TARGET): src/*
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<

$(TARGET): $(OBJ)
mkdir -p priv/native
gcc -o $(TARGET) $(SOURCES)
$(CC) $^ -o $@

clean:
rm -f priv/native/*
rm -f priv/native/* src/*.o