Skip to content

Commit

Permalink
Restructure tree
Browse files Browse the repository at this point in the history
The top-level directory is getting crowded. Make some subdirs:

ports:	Snek ports. All of these build snek for some device
chips:	SoC-specific code. To be used in building snek for some device
hosts:	Snek hosts. Targets for installers and places to run snekde

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed May 28, 2019
1 parent d03561d commit ca601a5
Show file tree
Hide file tree
Showing 150 changed files with 72 additions and 99 deletions.
8 changes: 3 additions & 5 deletions Makefile
Expand Up @@ -19,12 +19,12 @@ include snek-install.defs

SNEK_OTHEROS?=1
ifeq ($(SNEK_OTHEROS),1)
SNEK_OTHEROS_DIR=linux windows macosx
SNEK_OTHEROS_DIR=$(SNEK_HOSTS)/linux $(SNEK_HOSTS)/windows $(SNEK_HOSTS)/macosx
endif

SUBDIRS = snekde doc examples $(SNEK_OTHEROS_DIR)

SNEKS = posix/snek $(FIRMWARE)
SNEKS = $(SNEK_PORTS)/posix/snek $(FIRMWARE)

all: $(SNEKS)
+for dir in $(SUBDIRS); do (cd $$dir && make PREFIX=$(PREFIX) DESTDIR=$(DESTDIR)); done
Expand Down Expand Up @@ -66,9 +66,7 @@ install: $(SHAREFILES) $(PKGFILES) $(DOCFILES)

upload:
+cd doc && make upload
+cd linux && make upload
+cd windows && make upload
+cd macosx && make upload
for otheros in $(SNEK_OTHEROS_DIR); do cd "$$otheros" && make upload; done

snek.pc: snek.pc.in
$(SNEK_SED) $^ > $@
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion avr/snek-avr.defs → chips/avr/snek-avr.defs
Expand Up @@ -13,7 +13,6 @@
#

SNEK_AO = $(SNEK_ROOT)/ao
SNEK_AVR = $(SNEK_ROOT)/avr

SNEK_LOCAL_VPATH = $(SNEK_AVR):$(SNEK_AO)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion samd21/snek-samd21.defs → chips/samd21/snek-samd21.defs
Expand Up @@ -13,7 +13,6 @@
#

SNEK_AO = $(SNEK_ROOT)/ao
SNEK_SAMD21 = $(SNEK_ROOT)/samd21

SNEK_LOCAL_VPATH = $(SNEK_SAMD21):$(SNEK_AO)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions linux/Makefile → hosts/linux/Makefile
Expand Up @@ -12,19 +12,19 @@
# General Public License for more details.
#

SNEK_ROOT=..
SNEK_ROOT=../..

SNEK_NO_BUILD_TARGETS = 1

include ../snek-install.defs
include $(SNEK_ROOT)/snek-install.defs

LINUX_DIST=snek-linux-$(SNEK_VERSION).tar.bz2
LINUX_SH=snek-linux-$(SNEK_VERSION).sh
DESKTOP_FILES=../posix/snek.desktop.in ../snekde/snekde.desktop.in
PROGS=../posix/snek ../snekde/snekde ../snek-duino/snek-duino-install.in
EXAMPLES=../examples
ICONS=../snek.svg
DOC=../doc/snek.pdf ../snek-duino/snek-duino-install.1 ../snekde/snekde.1 ../COPYING
DESKTOP_FILES=$(SNEK_PORTS)/posix/snek.desktop.in $(SNEK_ROOT)/snekde/snekde.desktop.in
PROGS=$(SNEK_PORTS)/posix/snek $(SNEK_ROOT)/snekde/snekde $(SNEK_PORTS)/snek-duino/snek-duino-install.in
EXAMPLES=$(SNEK_ROOT)/examples
ICONS=$(SNEK_ROOT)/snek.svg
DOC=$(SNEK_ROOT)/doc/snek.pdf $(SNEK_PORTS)/snek-duino/snek-duino-install.1 $(SNEK_ROOT)/snekde/snekde.1 $(SNEK_ROOT)/COPYING
LINUX_FILES=$(PROGS) $(DESKTOP_FILES) $(FIRMWARE) $(USBFIRMWARE) $(ICONS) $(DOC) $(EXAMPLES)

all: $(LINUX_SH)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions macosx/Makefile → hosts/macosx/Makefile
Expand Up @@ -13,7 +13,7 @@
#

SNEK_NO_BUILD_TARGETS = 1
SNEK_ROOT=..
SNEK_ROOT=../..

include $(SNEK_ROOT)/snek-install.defs

Expand All @@ -22,7 +22,7 @@ MACOSX_ICON_PNGS = $(shell for i in $(MACOSX_RES); do echo snek-$$i.png; done)
MACOSX_ICON = snek.icns
MACOSX_DIST = snek-mac-$(SNEK_VERSION).dmg

SNEKDE = ../snekde/snekde.py
SNEKDE = $(SNEK_ROOT)/snekde/snekde.py
SNEKDE_SCRIPTS = runsnekde snekde-script
SNEKDE_FILES = $(SNEKDE_SCRIPTS) snekde-Info.plist $(SNEKDE)

Expand All @@ -34,13 +34,13 @@ endif

MACOSX_INSTALL = install-macosx

MACOSX_DOCS = ../doc/snek.pdf ../COPYING ReadMe-Mac.rtf
MACOSX_DOCS = $(SNEK_ROOT)/doc/snek.pdf $(SNEK_ROOT)/COPYING ReadMe-Mac.rtf

MACOSX_FILES=$(SNEKDE_FILES) $(SNEK_FILES) serial $(MACOSX_ICON) $(MACOSX_SCRIPTS) $(MACOSX_INSTALL) $(MACOSX_DOCS) ../examples/*.py
MACOSX_FILES=$(SNEKDE_FILES) $(SNEK_FILES) serial $(MACOSX_ICON) $(MACOSX_SCRIPTS) $(MACOSX_INSTALL) $(MACOSX_DOCS) $(SNEK_ROOT)/examples/*.py

all: $(MACOSX_DIST)

$(MACOSX_ICON): ../snek.svg
$(MACOSX_ICON): $(SNEK_ROOT)/snek.svg
for i in $(MACOSX_RES); do rsvg-convert -w $$i -h $$i -o snek-$$i.png $^; done
png2icns $@ $(MACOSX_ICON_PNGS)

Expand Down Expand Up @@ -70,7 +70,7 @@ $(MACOSX_DIST): $(MACOSX_FILES) macosx
cp -a $(MACOSX_INSTALL) macosx
cp -a $(FIRMWARE) macosx
cp -a $(USBFIRMWARE) macosx
cp -a ../examples/* macosx/examples
cp -a $(SNEK_ROOT)/examples/* macosx/examples
#
# snekde
#
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions macosx/build-mac → hosts/macosx/build-mac
Expand Up @@ -15,7 +15,7 @@

curdir=`pwd`
dir=`dirname $0`
cd "$dir/.."
cd "$dir/../.."

case $# in
2)
Expand All @@ -34,6 +34,6 @@ target="$2"

rsync -Ravz --delete `git ls-files` "$build"

ssh imac-remote "cd '$builddir'/posix && make"
ssh imac-remote "cd '$builddir'/ports/posix && make"

rsync -avz "$build"/posix/snek "$curdir"/"$target"
rsync -avz "$build"/ports/posix/snek "$curdir"/"$target"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions windows/Makefile → hosts/windows/Makefile
Expand Up @@ -12,17 +12,17 @@
# General Public License for more details.
#

SNEK_ROOT=..
SNEK_ROOT=../..

SNEK_LOCAL_SRC = \
snek-windows.c \
../snek-math.c
$(SNEK_ROOT)/snek-math.c

SNEK_LOCAL_INC = snek-windows.h
SNEK_LOCAL_BUILTINS = snek-windows.builtin ../snek-math.builtin
SNEK_LOCAL_BUILTINS = snek-windows.builtin $(SNEK_ROOT)/snek-math.builtin

INF=altusmetrum.inf
WINDOWS_FILES=snek.exe snek.ico snekde.py ../doc/snek.pdf ../examples ../COPYING $(FIRMWARE) $(USBFIRMWARE) $(INF)
WINDOWS_FILES=snek.exe snek.ico snekde.py $(SNEK_ROOT)/doc/snek.pdf $(SNEK_ROOT)/examples $(SNEK_ROOT)/COPYING $(FIRMWARE) $(USBFIRMWARE) $(INF)

include $(SNEK_ROOT)/snek-install.defs

Expand All @@ -42,15 +42,15 @@ all: $(WINDOWS_INSTALL)
$(WINDOWS_INSTALL): $(WINDOWS_FILES) snek.cfg
pynsist snek.cfg

snek.cfg: snek.cfg.in ../snek-install.defs ../snek.defs
snek.cfg: snek.cfg.in $(SNEK_ROOT)/snek-install.defs $(SNEK_ROOT)/snek.defs
for i in $(FIRMWARE); do echo " $$i"; done | sed '/@SNEK_FIRMWARE@/r /dev/stdin' snek.cfg.in | sed '/@SNEK_FIRMWARE/d' | $(SNEK_SED) > $@

snek.exe: $(SNEK_OBJ)
$(CC) $(CFLAGS) -o $@ $(SNEK_OBJ) $(LIBS)

vpath %.svg ..

snekde.py: ../snekde/snekde.py
snekde.py: $(SNEK_ROOT)/snekde/snekde.py
cp $^ $@

.SUFFIXES: .svg .build .icns .ico .rc .o .exe
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions windows/snek.cfg.in → hosts/windows/snek.cfg.in
Expand Up @@ -17,10 +17,10 @@ version=3.7.0
pypi_wheels=windows-curses==1.0
packages=serial

files =../COPYING
../doc/snek.pdf
files =@SNEK_ROOT@/COPYING
@SNEK_ROOT@/doc/snek.pdf
@SNEK_FIRMWARE@
../examples
@SNEK_ROOT@/examples
snek.exe
altusmetrum.inf
altusmetrum.cat
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions crickit-snek/Makefile → ports/crickit-snek/Makefile
Expand Up @@ -12,9 +12,9 @@
# General Public License for more details.
#

SNEK_ROOT = ..
SNEK_ROOT = ../..

SNEK_SAMD21 = $(SNEK_ROOT)/samd21
SNEK_SAMD21 = $(SNEK_ROOT)/chips/samd21

PROGNAME=crickit-snek
PRODUCT_NAME=CrickitSnek
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions feather-snek/Makefile → ports/feather-snek/Makefile
Expand Up @@ -12,9 +12,9 @@
# General Public License for more details.
#

SNEK_ROOT = ..
SNEK_ROOT = ../..

SNEK_SAMD21 = $(SNEK_ROOT)/samd21
SNEK_SAMD21 = $(SNEK_ROOT)/chips/samd21

PROGNAME=feather-snek
PRODUCT_NAME=FeatherSnek
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 4 additions & 20 deletions itsybitsy-snek/Makefile → ports/itsybitsy-snek/Makefile
Expand Up @@ -12,29 +12,13 @@
# General Public License for more details.
#

SNEK_ROOT = ..
SNEK_AVR = $(SNEK_ROOT)/avr
SNEK_ROOT = ../..
SNEK_AO = $(SNEK_ROOT)/ao
SNEK_AVR = $(SNEK_ROOT)/chips/avr

PROGNAME=itsybitsy-snek
PRODUCT_NAME=ItsyBitsySnek

#
# Copyright © 2019 Keith Packard <keithp@keithp.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#

SNEK_AO = $(SNEK_ROOT)/ao
SNEK_AVR = $(SNEK_ROOT)/avr

SNEK_LOCAL_VPATH = $(SNEK_AVR):$(SNEK_AO)

SNEK_AVR_SRC = \
Expand Down Expand Up @@ -99,7 +83,7 @@ SNEK_LOCAL_INC = \
SNEK_LOCAL_BUILTINS = \
$(SNEK_AVR_BUILTINS)

include ../snek-install.defs
include $(SNEK_ROOT)/snek-install.defs

BASE=$(PROGNAME)-$(SNEK_VERSION)
ELF=$(BASE).elf
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 4 additions & 20 deletions itsybitsy3v-snek/Makefile → ports/itsybitsy3v-snek/Makefile
Expand Up @@ -12,29 +12,13 @@
# General Public License for more details.
#

SNEK_ROOT = ..
SNEK_AVR = $(SNEK_ROOT)/avr
SNEK_ROOT = ../..
SNEK_AVR = $(SNEK_ROOT)/chips/avr
SNEK_AO = $(SNEK_ROOT)/ao

PROGNAME=itsybitsy3v-snek
PRODUCT_NAME=ItsyBitsySnek

#
# Copyright © 2019 Keith Packard <keithp@keithp.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#

SNEK_AO = $(SNEK_ROOT)/ao
SNEK_AVR = $(SNEK_ROOT)/avr

SNEK_LOCAL_VPATH = $(SNEK_AVR):$(SNEK_AO)

SNEK_AVR_SRC = \
Expand Down Expand Up @@ -98,7 +82,7 @@ SNEK_LOCAL_INC = \
SNEK_LOCAL_BUILTINS = \
$(SNEK_AVR_BUILTINS)

include ../snek-install.defs
include $(SNEK_ROOT)/snek-install.defs

BASE=$(PROGNAME)-$(SNEK_VERSION)
ELF=$(BASE).elf
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions metro-snek/Makefile → ports/metro-snek/Makefile
Expand Up @@ -12,9 +12,9 @@
# General Public License for more details.
#

SNEK_ROOT = ..
SNEK_ROOT = ../..

SNEK_SAMD21 = $(SNEK_ROOT)/samd21
SNEK_SAMD21 = $(SNEK_ROOT)/chips/samd21

PROGNAME=metro-snek
PRODUCT_NAME=MetroSnek
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions playground-snek/Makefile → ports/playground-snek/Makefile
Expand Up @@ -12,9 +12,9 @@
# General Public License for more details.
#

SNEK_ROOT = ..
SNEK_ROOT = ../..

SNEK_SAMD21 = $(SNEK_ROOT)/samd21
SNEK_SAMD21 = $(SNEK_ROOT)/chips/samd21

PROGNAME=playground-snek
PRODUCT_NAME=PlaygroundSnek
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions posix/Makefile → ports/posix/Makefile
Expand Up @@ -12,7 +12,7 @@
# General Public License for more details.
#

SNEK_ROOT=..
SNEK_ROOT=../..

SNEK_LOCAL_SRC = \
snek-main.c \
Expand All @@ -21,7 +21,7 @@ SNEK_LOCAL_SRC = \
snek-curses.c

SNEK_LOCAL_INC = snek-posix.h
SNEK_LOCAL_BUILTINS = snek-posix.builtin ../snek-math.builtin
SNEK_LOCAL_BUILTINS = snek-posix.builtin $(SNEK_ROOT)/snek-math.builtin

include $(SNEK_ROOT)/snek-install.defs

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions snek-duino/Makefile → ports/snek-duino/Makefile
Expand Up @@ -12,18 +12,20 @@
# General Public License for more details.
#

SNEK_ROOT = ..
SNEK_ROOT = ../..
SNEK_ATMEGA = $(SNEK_ROOT)/chips/atmega

SNEK_LOCAL_SRC = \
snek-duino.c \
snek-atmega-eeprom.c \
snek-io.c \
snek-atmega-serial.c

SNEK_LOCAL_VPATH = $(SNEK_ROOT)/atmega
SNEK_LOCAL_INC = $(SNEK_LOCAL_VPATH)/snek-atmega.h
SNEK_LOCAL_VPATH = $(SNEK_ATMEGA)
SNEK_LOCAL_INC = $(SNEK_ATMEGA)/snek-atmega.h
SNEK_LOCAL_BUILTINS = snek-duino.builtin

include ../snek-install.defs
include $(SNEK_ROOT)/snek-install.defs

SNEK_CFLAGS = $(SNEK_MOST_WARNINGS) $(SNEK_BASE_CFLAGS)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 7 additions & 4 deletions snek-mega/Makefile → ports/snek-mega/Makefile
Expand Up @@ -12,7 +12,9 @@
# General Public License for more details.
#

SNEK_ROOT = ..
SNEK_ROOT = ../..
SNEK_ATMEGA = $(SNEK_ROOT)/chips/atmega

SNEK_LOCAL_SRC = \
snek-mega.c \
snek-atmega-eeprom.c \
Expand All @@ -34,13 +36,14 @@ SNEK_LOCAL_SRC = \
kf_sin.c \
kf_cos.c

SNEK_LOCAL_VPATH = $(SNEK_ROOT)/atmega
SNEK_LOCAL_INC = $(SNEK_LOCAL_VPATH)/snek-atmega.h machine/ieeefp.h fdlibm.h snek-mega-math.h
SNEK_LOCAL_VPATH = $(SNEK_ATMEGA)
SNEK_LOCAL_INC = $(SNEK_ATMEGA)/snek-atmega.h machine/ieeefp.h fdlibm.h snek-mega-math.h

SNEK_LOCAL_BUILTINS = \
snek-mega.builtin \
snek-math.builtin

include ../snek-install.defs
include $(SNEK_ROOT)/snek-install.defs

SNEK_CFLAGS = $(SNEK_MOST_WARNINGS) $(SNEK_BASE_CFLAGS)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ca601a5

Please sign in to comment.