shrub/Makefile

415 lines
8.8 KiB
Makefile
Raw Normal View History

2013-09-29 00:21:18 +04:00
# A simple makefile.
#
# Pick one of:
# linux
# osx
2014-11-14 02:33:46 +03:00
default: all
-include make.conf
CORE=.MAKEFILE-VERSION
2013-09-29 00:21:18 +04:00
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-09-28 03:17:09 +04:00
CLD=g++ -g -L/usr/local/lib -L/opt/local/lib
2013-09-29 00:21:18 +04:00
ifeq ($(OS),osx)
2014-09-07 02:39:28 +04:00
COSFLAGS=-fno-diagnostics-fixit-info
2013-09-29 00:21:18 +04:00
CLDOSFLAGS=-bind_at_load
OSLIBS=-framework CoreServices -framework CoreFoundation
endif
ifeq ($(OS),linux)
2014-08-21 02:09:51 +04:00
OSLIBS=-lpthread -lrt -lcurses -lz
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
2014-11-06 00:54:52 +03:00
INCLUDE=i
MDEFINES=-DU3_OS_$(OS) -DU3_OS_ENDIAN_$(ENDIAN) -D U3_LIB=\"$(LIB)\"
2013-09-29 00:21:18 +04:00
2014-10-28 20:36:22 +03:00
# NOTFORCHECKIN - restore -O3
2014-11-29 05:19:11 +03:00
CFLAGS= $(COSFLAGS) -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) \
2014-08-23 01:39:35 +04:00
-Ioutside/libuv_0.11/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
2014-11-14 02:33:46 +03:00
ifdef NO_SILENT_RULES
%.o: %.c $(CORE)
$(CC) -c $(CWFLAGS) $(CFLAGS) -o $@ $<
@$(CC) -MM -MP $(CWFLAGS) $(CFLAGS) -MT $@ $< -MF .d/$*.d
else
%.o: %.c $(CORE)
@echo " CC $@"
@$(CC) -c $(CWFLAGS) $(CFLAGS) -o $@ $<
@$(CC) -MM -MP $(CWFLAGS) $(CFLAGS) -MT $@ $< -MF .d/$*.d
endif
2013-09-29 00:21:18 +04:00
2014-11-06 22:29:53 +03:00
N_OFILES=\
n/a.o \
n/e.o \
n/h.o \
n/i.o \
n/j.o \
n/m.o \
n/n.o \
n/r.o \
n/t.o \
n/x.o \
n/v.o \
n/z.o
2013-09-29 00:21:18 +04:00
2014-11-06 22:49:41 +03:00
J_A_OFILES=\
j/a/add.o \
j/a/dec.o \
j/a/div.o \
j/a/gte.o \
j/a/gth.o \
j/a/lte.o \
j/a/lth.o \
j/a/mod.o \
j/a/mul.o \
j/a/sub.o
2014-09-05 23:55:16 +04:00
2014-11-06 22:49:41 +03:00
J_B_OFILES=\
j/b/bind.o \
j/b/clap.o \
j/b/drop.o \
j/b/flop.o \
j/b/lent.o \
j/b/levy.o \
j/b/lien.o \
j/b/need.o \
j/b/reel.o \
j/b/roll.o \
j/b/skim.o \
j/b/skip.o \
j/b/scag.o \
j/b/slag.o \
j/b/snag.o \
j/b/sort.o \
j/b/turn.o \
j/b/weld.o
2014-09-05 23:55:16 +04:00
2014-11-06 22:49:41 +03:00
J_C_OFILES=\
j/c/bex.o \
j/c/can.o \
j/c/cap.o \
j/c/cat.o \
j/c/con.o \
j/c/cut.o \
j/c/dor.o \
j/c/dis.o \
j/c/end.o \
j/c/gor.o \
j/c/hor.o \
j/c/lsh.o \
j/c/mas.o \
j/c/met.o \
j/c/mix.o \
j/c/mug.o \
j/c/peg.o \
j/c/po.o \
j/c/rap.o \
j/c/rip.o \
j/c/rsh.o \
j/c/vor.o
2014-09-05 23:55:16 +04:00
2014-11-06 22:49:41 +03:00
J_D_OFILES=\
j/d/in_has.o \
j/d/in_int.o \
j/d/in_gas.o \
j/d/in_mer.o \
j/d/in_put.o \
j/d/in_tap.o \
j/d/in_uni.o \
j/d/by_gas.o \
j/d/by_get.o \
j/d/by_has.o \
j/d/by_int.o \
j/d/by_put.o \
j/d/by_uni.o
2014-09-05 23:55:16 +04:00
2014-11-06 22:49:41 +03:00
J_E_OFILES=\
j/e/aesc.o \
j/e/cue.o \
j/e/jam.o \
j/e/mat.o \
j/e/mink.o \
j/e/mule.o \
j/e/parse.o \
j/e/rd.o \
j/e/repg.o \
j/e/rexp.o \
j/e/rub.o \
j/e/shax.o \
j/e/lore.o \
j/e/loss.o \
j/e/trip.o
2014-09-05 23:55:16 +04:00
2014-11-06 22:49:41 +03:00
J_E_OFILES_ED=\
j/e/ed_puck.o \
j/e/ed_sign.o \
j/e/ed_veri.o
2014-09-05 23:55:16 +04:00
2014-11-06 22:49:41 +03:00
J_F_OFILES=\
j/f/al.o \
j/f/ap.o \
j/f/bull.o \
j/f/cell.o \
j/f/comb.o \
j/f/cons.o \
j/f/core.o \
j/f/cube.o \
j/f/face.o \
j/f/fitz.o \
j/f/flan.o \
j/f/flay.o \
j/f/flip.o \
j/f/flor.o \
j/f/fork.o \
j/f/hike.o \
j/f/look.o \
2014-09-05 23:55:16 +04:00
2014-11-06 22:49:41 +03:00
J_F_OFILES_UT=\
j/f/ut.o \
j/f/ut_burn.o \
j/f/ut_busk.o \
j/f/ut_bust.o \
j/f/ut_conk.o \
j/f/ut_crop.o \
j/f/ut_cull.o \
j/f/ut_find.o \
j/f/ut_fink.o \
j/f/ut_fire.o \
j/f/ut_firm.o \
j/f/ut_fish.o \
j/f/ut_fuse.o \
j/f/ut_gain.o \
j/f/ut_heal.o \
j/f/ut_lose.o \
j/f/ut_mint.o \
j/f/ut_mull.o \
j/f/ut_nest.o \
j/f/ut_park.o \
j/f/ut_peek.o \
j/f/ut_play.o \
j/f/ut_repo.o \
j/f/ut_rest.o \
j/f/ut_seek.o \
j/f/ut_swab.o \
j/f/ut_tack.o \
j/f/ut_tock.o \
j/f/ut_wrap.o
2014-09-05 23:55:16 +04:00
J_OFILES=\
2014-11-06 22:49:41 +03:00
$(J_A_OFILES) \
$(J_B_OFILES) \
$(J_C_OFILES) \
$(J_D_OFILES) \
$(J_E_OFILES) \
$(J_E_OFILES_ED) \
$(J_F_OFILES) \
$(J_F_OFILES_UT) \
j/tree.o
2014-09-05 23:55:16 +04:00
2014-11-06 22:29:53 +03:00
BASE_OFILES=$(N_OFILES) $(J_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 \
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/raft.o \
2013-09-29 00:21:18 +04:00
v/reck.o \
v/sist.o \
2014-10-15 06:25:23 +04:00
v/temp.o \
2013-09-29 00:21:18 +04:00
v/term.o \
2014-08-21 02:09:51 +04:00
v/time.o \
2013-09-29 00:21:18 +04:00
v/unix.o \
2014-10-31 00:40:05 +03:00
v/save.o \
2014-01-17 21:38:15 +04:00
v/walk.o
2014-08-21 02:09:51 +04:00
MAIN_FILE =\
v/main.o
2014-09-29 01:56:17 +04:00
MEME_FILE =\
w/test.o
2014-01-17 21:38:15 +04:00
VERE_OFILES=\
$(CRE2_OFILES) \
$(OUT_OFILES) \
$(BASE_OFILES) \
$(MAIN_FILE) \
$(V_OFILES)
2013-09-29 00:21:18 +04:00
2014-09-29 01:56:17 +04:00
MEME_OFILES=\
$(CRE2_OFILES) \
$(OUT_OFILES) \
$(BASE_OFILES) \
$(MEME_FILE)
2014-11-14 02:33:46 +03:00
VERE_DFILES=$(VERE_OFILES:%.o=.d/%.d)
-include $(VERE_DFILES)
# This is a silly hack necessitated by the fact that libuv uses configure
#
# * Making 'all' obviously requires outside/libuv,
# which requires the libuv Makefile to be created.
# * Making distclean on outside/libuv destroys the makefile.
# * ...so configuring outside/libuv is parodoxically required
# in order to distclean it!
# * But what if developer types 'make distclean all' ?
# * first target makes libuv Makefile, then destroys it...and
# second target knows that it was made.
# * ...so second target borks.
# * Solution: make libuv not only depend on its own Makefile,
# but on a side effect of creating its own makefile.
#
LIBUV_MAKEFILE=outside/libuv_0.11/Makefile
LIBUV_MAKEFILE2=outside/libuv_0.11/config.log
2014-08-26 00:57:13 +04:00
2014-08-23 01:39:35 +04:00
LIBUV=outside/libuv_0.11/.libs/libuv.a
2013-09-29 00:21:18 +04:00
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
2014-10-01 23:17:40 +04:00
all: vere
2014-09-29 01:56:17 +04:00
2014-11-14 02:33:46 +03:00
.MAKEFILE-VERSION: Makefile make.conf
@echo "Makefile update."
@touch .MAKEFILE-VERSION
make.conf:
@echo "# Set custom configuration here, please!" > "make.conf"
2014-08-21 02:09:51 +04:00
vere: $(BIN)/vere
2014-09-22 20:10:57 +04:00
meme: $(BIN)/meme
2014-08-21 02:09:51 +04:00
$(LIBUV_MAKEFILE) $(LIBUV_MAKEFILE2):
2014-08-28 01:42:33 +04:00
cd outside/libuv_0.11 ; sh autogen.sh ; ./configure --disable-dtrace
2013-09-29 00:21:18 +04:00
$(LIBUV): $(LIBUV_MAKEFILE) $(LIBUV_MAKEFILE2)
2014-08-23 01:39:35 +04:00
$(MAKE) -C outside/libuv_0.11 all-am
2014-02-06 01:55:30 +04:00
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
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-11-06 00:54:52 +03:00
$(V_OFILES): i/v/vere.h
2014-01-17 21:38:15 +04:00
2014-11-14 02:33:46 +03:00
ifdef NO_SILENT_RULES
$(BIN)/vere: $(LIBCRE) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM)
2013-09-29 00:21:18 +04:00
mkdir -p $(BIN)
$(CLD) $(CLDOSFLAGS) -o $(BIN)/vere $(VERE_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS)
2014-11-14 02:33:46 +03:00
else
$(BIN)/vere: $(LIBCRE) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM)
@echo " CCLD $(BIN)/vere"
@mkdir -p $(BIN)
@$(CLD) $(CLDOSFLAGS) -o $(BIN)/vere $(VERE_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS)
endif
2014-09-22 20:10:57 +04:00
2014-09-29 01:56:17 +04:00
$(BIN)/meme: $(LIBCRE) $(MEME_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM)
2014-09-22 20:10:57 +04:00
mkdir -p $(BIN)
$(CLD) $(CLDOSFLAGS) -o $(BIN)/meme $(MEME_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS)
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
clean:
2014-11-14 02:33:46 +03:00
$(RM) $(VERE_OFILES) $(BIN)/vere vere.pkg $(VERE_DFILES)
2014-04-10 23:06:40 +04:00
distclean: clean $(LIBUV_MAKEFILE)
2014-08-26 00:57:13 +04:00
$(MAKE) -C outside/libuv_0.11 distclean
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-22 03:21:16 +04:00
2014-06-10 22:19:55 +04:00
.PHONY: clean debbuild debinstalldistclean etags osxpackage tags