-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile.termux
58 lines (49 loc) · 1.44 KB
/
Makefile.termux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# Tiny BASIC Interpreter and Compiler Project
# Makefile for clang under Termux/Android
#
# Released as Public Domain by Damian Gareth Walker 2019
# Created: 24-Sep-2019
#
# Target
TARGET = tinybasic
# Paths and extensions
SRCDIR := src
INCDIR := inc
DOCDIR := doc
BASDIR := bas
BUILDDIR := obj
TARGETDIR := bin
INSTALLDIR := /data/data/com.termux/files/usr
SRCEXT := c
HDREXT := h
OBJEXT := o
MANEXT := man
BASEXT := bas
# Compiler flags
CFLAGS := -Wall
INC := -I$(INCDIR) -I/usr/local/include
# Generate file lists
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJEXT)))
SAMPLES := $(shell find $(BASDIR) -type f -name *.$(BASEXT))
# Default make
all: $(TARGETDIR)/$(TARGET)
$(TARGETDIR)/$(TARGET): $(OBJECTS)
gcc -o $(TARGETDIR)/$(TARGET) $(OBJECTS)
termux-elf-cleaner $(TARGETDIR)/$(TARGET)
$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
gcc $(CFLAGS) $(INC) -c -o $@ $<
# Cleanup
clean:
rm -f $(BUILDDIR)/*.$(OBJEXT)
rm -f $(TARGETDIR)/$(TARGET)
# Installation (Unix)
install: $(TARGETDIR)/$(TARGET) $(DOCDIR)/tinybasic.man $(SAMPLES)
mkdir -p $(INSTALLDIR)/bin
cp $(TARGETDIR)/$(TARGET) $(INSTALLDIR)/bin
chmod +x $(INSTALLDIR)/bin/$(TARGET)
mkdir -p $(INSTALLDIR)/share/man/man1
cp $(DOCDIR)/tinybasic.man $(INSTALLDIR)/share/man/man1/tinybasic.1
mkdir -p $(INSTALLDIR)/share/doc/tinybasic/samples
cp $(SAMPLES) $(INSTALLDIR)/share/doc/tinybasic/samples