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

Fixes to compile on Termux #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
24 changes: 15 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@ INSTALL_MKDIR = $(INSTALL) -d -m 755
OS=$(shell uname)

ifneq ($(OS),Darwin)
LDFLAGS += -lrt
DSO_LDFLAGS += -lrt
LDFLAGS += -lrt
DSO_LDFLAGS += -lrt
endif

PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin

# Targets
# Termux-specific configuration
termux: PREFIX=/data/data/com.termux/files/usr
termux: CFLAGS += -I$(PREFIX)/include
termux: TERMUX_LDFLAGS = -L$(PREFIX)/lib -ltoxcore -ltoxencryptsave -lsodium -lm
termux: gitversion.h tox_bootstrap.h $(OBJECTS)
$(CC) -o tuntox $(OBJECTS) $(TERMUX_LDFLAGS)

# Original targets
all: tuntox tuntox_nostatic

gitversion.h: FORCE
Expand All @@ -31,21 +38,20 @@ gitversion.h: FORCE
echo "#define GITVERSION \"$(shell git rev-parse HEAD)\"" > $@; \
fi


FORCE:

tox_bootstrap.h:
$(PYTHON) generate_tox_bootstrap.py
tox_bootstrap.h:
$(PYTHON) generate_tox_bootstrap.py

%.o: %.c $(INCLUDES) gitversion.h tox_bootstrap.h
@echo " CC $@"
@$(CC) -c $(CFLAGS) $< -o $@

tuntox: $(OBJECTS) $(INCLUDES)
$(CC) -o $@ $(OBJECTS) -lpthread $(LDFLAGS)
$(CC) -o $@ $(OBJECTS) -lpthread $(LDFLAGS)

tuntox_nostatic: $(OBJECTS) $(INCLUDES)
$(CC) -o $@ $(OBJECTS) -lpthread $(DSO_LDFLAGS)
$(CC) -o $@ $(OBJECTS) -lpthread $(DSO_LDFLAGS)

cscope.out:
@echo " GEN $@"
Expand All @@ -58,4 +64,4 @@ install: tuntox_nostatic
$(INSTALL_MKDIR) -d $(DESTDIR)$(BINDIR)
$(INSTALL) tuntox_nostatic $(DESTDIR)$(BINDIR)/tuntox

.PHONY: all clean tuntox
.PHONY: all clean tuntox termux