shrub/Makefile

372 lines
7.9 KiB
Makefile
Raw Normal View History

2013-09-29 00:21:18 +04:00
# A simple makefile.
#
# Pick one of:
# linux
# osx
UNAME=$(shell uname)
ifeq ($(UNAME),Darwin)
OS=osx
else ifeq ($(UNAME),Linux)
OS=linux
else ifeq ($(UNAME),FreeBSD)
OS=bsd
2013-10-30 22:44:35 +04:00
else ifeq ($(UNAME),OpenBSD)
OS=bsd
2013-09-29 00:21:18 +04:00
else
$(error unknown unix)
endif
# Pick one of:
# little
# big
#
ENDIAN=little
# Binary directory - not in quotes.
#
BIN=bin
LIB=$(PWD)/urb
2013-09-29 00:21:18 +04:00
RM=rm -f
CC=gcc
CXX=g++
CXXFLAGS=$(CFLAGS)
2014-08-22 10:05:41 +04:00
CLD=g++ -L/usr/local/lib -L/opt/local/lib
2013-09-29 00:21:18 +04:00
ifeq ($(OS),osx)
CLDOSFLAGS=-bind_at_load
OSLIBS=-framework CoreServices -framework CoreFoundation
endif
ifeq ($(OS),linux)
2014-04-10 03:35:31 +04:00
OSLIBS=-lpthread -lrt -lcurses
2014-01-27 22:48:55 +04:00
DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
2013-09-29 00:21:18 +04:00
endif
ifeq ($(OS),bsd)
2014-04-10 03:35:31 +04:00
OSLIBS=-lpthread -lncurses -lkvm
endif
2013-09-29 00:21:18 +04:00
2014-05-20 02:07:05 +04:00
ifeq ($(STATIC),yes)
LIBS=-lssl -lcrypto -lncurses /usr/local/lib/libsigsegv.a /usr/local/lib/libgmp.a $(OSLIBS)
else
2014-04-10 22:50:13 +04:00
LIBS=-lssl -lcrypto -lgmp -lncurses -lsigsegv $(OSLIBS)
2014-05-20 02:07:05 +04:00
endif
2013-09-29 00:21:18 +04:00
INCLUDE=include
2014-07-09 07:20:38 +04:00
MDEFINES=-DU2_OS_$(OS) -DU2_OS_ENDIAN_$(ENDIAN) -D U2_LIB=\"$(LIB)\"
2013-09-29 00:21:18 +04:00
2014-08-25 10:58:38 +04:00
CFLAGS= -g -msse3 -ffast-math \
2014-06-10 22:02:33 +04:00
-funsigned-char \
2013-09-29 00:21:18 +04:00
-I/usr/local/include \
-I/opt/local/include \
-I$(INCLUDE) \
2013-09-29 00:21:18 +04:00
-Ioutside/libuv/include \
-Ioutside/anachronism/include \
-Ioutside/bpt \
2014-04-10 22:50:13 +04:00
-Ioutside/re2 \
-Ioutside/cre2/src/src \
2014-04-11 05:05:59 +04:00
-Ioutside/ed25519/src \
2014-01-27 22:48:55 +04:00
$(DEFINES) \
$(MDEFINES)
2013-09-29 00:21:18 +04:00
CWFLAGS=-Wall
.c.o:
$(CC) -c $(CWFLAGS) $(CFLAGS) -o $@ $<
F_OFILES=\
f/rail.o \
f/loom.o \
f/wire.o \
f/chad.o \
f/cash.o \
2014-04-24 06:34:32 +04:00
f/nash.o \
2013-09-29 00:21:18 +04:00
f/coal.o \
f/hevn.o \
f/host.o \
f/benx.o \
f/trac.o \
f/bail.o \
f/dash.o \
f/unix.o \
f/nock.o
2014-01-07 00:37:42 +04:00
J164_1_OFILES=\
gen164/1/add.o \
gen164/1/dec.o \
gen164/1/div.o \
gen164/1/gte.o \
gen164/1/gth.o \
gen164/1/lte.o \
gen164/1/lth.o \
gen164/1/mod.o \
gen164/1/mul.o \
gen164/1/sub.o
J164_2_OFILES=\
gen164/2/bind.o \
gen164/2/clap.o \
gen164/2/drop.o \
gen164/2/flop.o \
gen164/2/lent.o \
gen164/2/levy.o \
gen164/2/lien.o \
gen164/2/need.o \
gen164/2/reel.o \
gen164/2/roll.o \
gen164/2/skim.o \
gen164/2/skip.o \
2014-05-27 04:33:41 +04:00
gen164/2/scag.o \
2014-01-07 00:37:42 +04:00
gen164/2/slag.o \
gen164/2/snag.o \
gen164/2/sort.o \
gen164/2/turn.o \
gen164/2/weld.o
J164_3_OFILES=\
gen164/3/bex.o \
gen164/3/can.o \
gen164/3/cap.o \
gen164/3/cat.o \
gen164/3/con.o \
gen164/3/cut.o \
gen164/3/dor.o \
gen164/3/dis.o \
gen164/3/end.o \
gen164/3/gor.o \
gen164/3/hor.o \
gen164/3/lsh.o \
gen164/3/mas.o \
gen164/3/met.o \
gen164/3/mix.o \
gen164/3/mug.o \
gen164/3/peg.o \
gen164/3/po.o \
gen164/3/rap.o \
gen164/3/rip.o \
gen164/3/rsh.o \
gen164/3/vor.o
J164_4_OFILES=\
gen164/4/in.o \
gen164/4/by.o \
gen164/4/in_has.o \
gen164/4/in_int.o \
2014-01-07 00:37:42 +04:00
gen164/4/in_gas.o \
2014-06-11 07:02:20 +04:00
gen164/4/in_mer.o \
2014-01-07 00:37:42 +04:00
gen164/4/in_put.o \
gen164/4/in_tap.o \
gen164/4/in_uni.o \
2014-01-07 00:37:42 +04:00
gen164/4/by_gas.o \
gen164/4/by_get.o \
gen164/4/by_has.o \
gen164/4/by_int.o \
2014-04-16 00:07:11 +04:00
gen164/4/by_put.o \
gen164/4/by_uni.o
2014-01-07 00:37:42 +04:00
J164_5_OFILES=\
gen164/5/aesc.o \
2014-01-07 00:37:42 +04:00
gen164/5/cue.o \
2014-04-11 05:05:59 +04:00
gen164/5/ed.o \
2014-01-07 00:37:42 +04:00
gen164/5/jam.o \
gen164/5/mat.o \
gen164/5/mink.o \
2014-05-19 03:16:01 +04:00
gen164/5/mule.o \
2014-01-07 00:37:42 +04:00
gen164/5/parse.o \
gen164/5/rd.o \
2014-04-09 22:57:48 +04:00
gen164/5/repg.o \
gen164/5/rexp.o \
2014-01-07 00:37:42 +04:00
gen164/5/rub.o \
gen164/5/shax.o \
gen164/5/lore.o \
gen164/5/loss.o \
gen164/5/tape.o \
gen164/5/trip.o
J164_5_OFILES_CO=\
gen164/5/co_emco.o \
gen164/5/co_oxco.o \
gen164/5/co_roco.o
2014-04-11 05:05:59 +04:00
J164_5_OFILES_ED=\
gen164/5/ed_puck.o \
2014-04-13 06:59:02 +04:00
gen164/5/ed_sign.o \
gen164/5/ed_veri.o
2014-04-11 05:05:59 +04:00
2014-01-07 00:37:42 +04:00
J164_6_OFILES=\
gen164/6/al.o \
gen164/6/ap.o \
gen164/6/bull.o \
gen164/6/cell.o \
gen164/6/comb.o \
gen164/6/cons.o \
gen164/6/core.o \
gen164/6/cube.o \
gen164/6/face.o \
gen164/6/fitz.o \
gen164/6/flan.o \
gen164/6/flay.o \
gen164/6/flip.o \
gen164/6/flor.o \
gen164/6/fork.o \
gen164/6/hike.o \
gen164/6/look.o \
gen164/6/ut.o
J164_6_OFILES_UT=\
gen164/6/ut_burn.o \
gen164/6/ut_busk.o \
gen164/6/ut_bust.o \
gen164/6/ut_conk.o \
gen164/6/ut_crop.o \
gen164/6/ut_cull.o \
gen164/6/ut_find.o \
gen164/6/ut_fink.o \
gen164/6/ut_fire.o \
gen164/6/ut_firm.o \
gen164/6/ut_fish.o \
gen164/6/ut_fuse.o \
gen164/6/ut_gain.o \
gen164/6/ut_heal.o \
gen164/6/ut_lose.o \
gen164/6/ut_mint.o \
gen164/6/ut_moot.o \
gen164/6/ut_mull.o \
gen164/6/ut_nest.o \
gen164/6/ut_park.o \
gen164/6/ut_peek.o \
gen164/6/ut_play.o \
gen164/6/ut_repo.o \
gen164/6/ut_rest.o \
gen164/6/ut_seek.o \
gen164/6/ut_swab.o \
gen164/6/ut_tack.o \
gen164/6/ut_tock.o \
gen164/6/ut_wrap.o
J164_OFILES=\
$(J164_1_OFILES) \
$(J164_2_OFILES) \
$(J164_3_OFILES) \
$(J164_4_OFILES) \
$(J164_5_OFILES) \
$(J164_5_OFILES_CO) \
2014-04-11 05:05:59 +04:00
$(J164_5_OFILES_ED) \
2014-01-07 00:37:42 +04:00
$(J164_6_OFILES) \
$(J164_6_OFILES_UT) \
gen164/watt.o
2013-09-29 00:21:18 +04:00
BASE_OFILES=\
$(F_OFILES) \
2014-01-07 00:37:42 +04:00
$(J164_OFILES)
2013-09-29 00:21:18 +04:00
CRE2_OFILES=\
outside/cre2/src/src/cre2.o
2013-09-29 00:21:18 +04:00
OUT_OFILES=\
outside/jhttp/http_parser.o
2014-01-17 21:38:15 +04:00
V_OFILES=\
2013-09-29 00:21:18 +04:00
v/ames.o \
v/batz.o \
2014-02-27 04:40:08 +04:00
v/cttp.o \
2013-09-29 00:21:18 +04:00
v/http.o \
v/loop.o \
v/main.o \
v/raft.o \
2013-09-29 00:21:18 +04:00
v/reck.o \
v/save.o \
v/sist.o \
2013-09-29 00:21:18 +04:00
v/time.o \
v/term.o \
v/unix.o \
2014-01-17 21:38:15 +04:00
v/walk.o
VERE_OFILES=\
2013-09-29 00:21:18 +04:00
$(BASE_OFILES) \
$(CRE2_OFILES) \
$(OUT_OFILES) \
$(V_OFILES)
2013-09-29 00:21:18 +04:00
LIBUV=outside/libuv/libuv.a
2014-04-10 22:50:13 +04:00
LIBRE2=outside/re2/obj/libre2.a
2014-04-11 04:09:01 +04:00
LIBED25519=outside/ed25519/ed25519.a
2014-05-20 02:07:05 +04:00
LIBANACHRONISM=outside/anachronism/build/libanachronism.a
BPT_O=outside/bpt/bitmapped_patricia_tree.o
2014-04-11 04:09:01 +04:00
2014-08-18 10:10:46 +04:00
all: $(BIN)/meme
2013-09-29 00:21:18 +04:00
2014-04-10 22:50:13 +04:00
$(LIBUV):
2014-02-06 01:55:30 +04:00
$(MAKE) -C outside/libuv libuv.a
2014-04-10 22:50:13 +04:00
$(LIBRE2):
$(MAKE) -C outside/re2 obj/libre2.a
2014-04-11 04:09:01 +04:00
$(LIBED25519):
$(MAKE) -C outside/ed25519
$(LIBANACHRONISM):
$(MAKE) -C outside/anachronism static
$(BPT_O): outside/bpt/bitmapped_patricia_tree.c
2014-08-25 10:58:38 +04:00
$(CC) -g -o $@ -c $<
2014-04-10 22:50:13 +04:00
$(CRE2_OFILES): outside/cre2/src/src/cre2.cpp outside/cre2/src/src/cre2.h $(LIBRE2)
$(CXX) $(CXXFLAGS) -c $< $(LIBRE2) -o $@
2014-04-09 22:57:48 +04:00
2014-01-17 21:38:15 +04:00
$(V_OFILES) f/loom.o f/trac.o: include/v/vere.h
$(BIN)/vere: $(LIBCRE) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(BPT_O) $(LIBANACHRONISM)
2013-09-29 00:21:18 +04:00
mkdir -p $(BIN)
$(CLD) $(CLDOSFLAGS) -o $(BIN)/vere $(VERE_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(BPT_O) $(LIBANACHRONISM) $(LIBS)
2013-09-29 00:21:18 +04:00
2014-08-18 10:10:46 +04:00
meme: $(BIN)/meme
2014-08-28 23:40:40 +04:00
MEME_OFILES=f/meme.o $(J164_OFILES) $(CRE2_OFILES)
$(BIN)/meme: $(MEME_OFILES) $(LIBED25519)
$(CLD) -g $(CLDOSFLAGS) -o $(BIN)/meme $(MEME_OFILES) $(LIBRE2) $(LIBED25519) -lgmp
2014-08-18 10:10:46 +04:00
2013-09-29 00:21:18 +04:00
tags:
ctags -R -f .tags --exclude=root
etags:
etags -f .etags $$(find -name '*.c' -or -name '*.h')
2014-05-20 02:07:05 +04:00
osxpackage:
$(RM) -r inst
$(MAKE) distclean
$(MAKE) $(BIN)/vere LIB=/usr/local/lib/urb STATIC=yes
mkdir -p inst/usr/local/lib/urb inst/usr/local/bin
cp $(BIN)/vere inst/usr/local/bin
cp urb/urbit.pill inst/usr/local/lib/urb
cp -R urb/zod inst/usr/local/lib/urb
pkgbuild --root inst --identifier org.urbit.vere --version 0.2 vere.pkg
2014-05-22 03:21:16 +04:00
debbuild:
2014-05-26 05:48:07 +04:00
$(MAKE) $(BIN)/vere LIB=/usr/share/urb
2014-05-22 03:21:16 +04:00
debinstall:
2014-05-26 05:48:07 +04:00
mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/usr/share/urb
2014-05-22 03:21:16 +04:00
install -m755 $(BIN)/vere $(DESTDIR)/usr/bin
2014-05-26 05:48:07 +04:00
cp urb/urbit.pill $(DESTDIR)/usr/share/urb
cp -R urb/zod $(DESTDIR)/usr/share/urb
2014-05-22 03:21:16 +04:00
2013-09-29 00:21:18 +04:00
clean:
2014-05-20 02:07:05 +04:00
$(RM) $(VERE_OFILES) $(BIN)/vere vere.pkg
2014-04-10 23:06:40 +04:00
distclean: clean
$(MAKE) -C outside/libuv clean
2014-04-10 22:50:13 +04:00
$(MAKE) -C outside/re2 clean
2014-04-11 04:09:01 +04:00
$(MAKE) -C outside/ed25519 clean
$(MAKE) -C outside/anachronism clean
2014-05-20 02:07:05 +04:00
$(RM) $(BPT_O)
2014-05-22 03:21:16 +04:00
2014-06-10 22:19:55 +04:00
.PHONY: clean debbuild debinstalldistclean etags osxpackage tags