<NME> Makefile
<BEF> CC=gcc
EMCC=emcc
CFLAGS+=-g -std=c99 -std=gnu99 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DDEBUG -D_GNU_SOURCE
#CFLAGS+=-Weverything -Wno-unused-macros -Wno-undef -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-gnu-label-as-value -Wno-gnu-designator -Wno-missing-prototypes -Wno-format-nonliteral
INCLUDE+=-Iinclude -Iinclude/lib -Iunix -Ithrowback

LIB = src/lib/lob.c src/lib/hashname.c src/lib/xht.c src/lib/js0n.c src/lib/base32.c src/lib/chacha.c src/lib/murmur.c src/lib/jwt.c src/lib/base64.c src/lib/aes128.c src/lib/sha256.c src/lib/uECC.c
E3X = src/e3x/e3x.c src/e3x/self.c src/e3x/exchange.c src/e3x/cipher.c
MESH = src/mesh.c src/link.c src/chan.c
EXT = 
#NET = src/net/loopback.c src/net/udp4.c src/net/tcp4.c src/net/serial.c
NET = src/net/loopback.c 
UTIL = src/util/util.c src/util/chunks.c src/util/frames.c src/unix/util.c src/unix/util_sys.c
THROWBACK = throwback/all.c throwback/lob.c throwback/xform.c throwback/xform_hex.c

# CS1c by default
CS = src/e3x/cs1c/cs1c.c 

# check for CS3a deps
ifneq ("$(wildcard node_modules/libsodium-c/src/libsodium/.libs/libsodium.a)","")
CS += src/e3x/cs3a/cs3a.c
LDFLAGS += node_modules/libsodium-c/src/libsodium/.libs/libsodium.a
INCLUDE += -I./node_modules/libsodium-c/src/libsodium/include
else
CS += src/e3x/cs3a_disabled.c
endif

LIB_OBJFILES = $(patsubst %.c,%.o,$(LIB))
E3X_OBJFILES = $(patsubst %.c,%.o,$(E3X))
MESH_OBJFILES = $(patsubst %.c,%.o,$(MESH))
EXT_OBJFILES = $(patsubst %.c,%.o,$(EXT))
NET_OBJFILES = $(patsubst %.c,%.o,$(NET))
UTIL_OBJFILES = $(patsubst %.c,%.o,$(UTIL))
CS_OBJFILES = $(patsubst %.c,%.o,$(CS))
TB_OBJFILES = $(patsubst %.c,%.o,$(THROWBACK))

FULL_OBJFILES = $(LIB_OBJFILES) $(E3X_OBJFILES) $(MESH_OBJFILES) $(EXT_OBJFILES) $(NET_OBJFILES) $(UTIL_OBJFILES) $(CS_OBJFILES)

IDGEN_OBJFILES = $(FULL_OBJFILES) util/idgen.o
ROUTER_OBJFILES = $(FULL_OBJFILES) src/net/udp4.o util/router.o 
PING_OBJFILES = $(FULL_OBJFILES) util/ping.o 

HEADERS=$(wildcard include/*.h)

all: idgen ping static
	@echo "TODO\t`git grep TODO | wc -l | tr -d ' '`"

deps:
	npm install

# todo, this header mangling process is a drag

static: libtelehash
	@cat $(LIB) $(E3X) $(MESH) $(EXT) $(UTIL) > telehash.c
	@cat include/lob.h include/xht.h include/e3x_cipher.h include/e3x_self.h include/e3x_exchange.h include/hashname.h include/mesh.h include/link.h include/chan.h include/util_chunks.h include/util_frames.h include/*.h > telehash.h
	@sed -i.bak "/#include \".*h\"/d" telehash.h
	@rm -f telehash.h.bak

static-cs1c:
	@echo "#include <telehash.h>" > telehash.c
	@cat $(LIB) $(E3X) $(MESH) $(EXT) $(UTIL) src/e3x/cs1c/cs1c.c src/e3x/cs3a_disabled.c >> telehash.c
	@sed -i '' "/#include \".*h\"/d" telehash.c
	@cat include/lob.h include/xht.h include/e3x_cipher.h include/e3x_self.h include/e3x_exchange.h include/hashname.h include/mesh.h include/link.h include/chan.h include/util_chunks.h include/util_frames.h include/*.h > telehash.h
	@sed -i.bak "/#include \".*h\"/d" telehash.h
	@rm -f telehash.h.bak

	cp $(HEADERS) arduino/src/telehash/

test: $(FULL_OBJFILES)
	cd test; $(MAKE) $(MFLAGS)

%.o : %.c $(HEADERS)

libtelehash: $(FULL_OBJFILES)
	rm -f libtelehash.a
	ar crs libtelehash.a $(FULL_OBJFILES)

throwback-update:
	cd ../throwback && make static
	cp ../throwback/dew.c throwback/
	cp ../throwback/dew.h throwback/

throwback-test: $(FULL_OBJFILES) $(TB_OBJFILES)
	$(CC) $(CFLAGS) $(INCLUDE) -o test/bin/test_throwback throwback/test.c throwback/dew.c $(TB_OBJFILES) $(FULL_OBJFILES) $(LDFLAGS)
	./test/bin/test_throwback

.PHONY: arduino test TAGS

test: $(FULL_OBJFILES) ping
	cd test; $(MAKE) $(MFLAGS)

TAGS:
	find . | grep ".*\.\(h\|c\)" | xargs etags -f TAGS

%.o : %.c $(HEADERS)
	$(CC) $(INCLUDE) $(CFLAGS) -c $< -o $@

idgen: $(IDGEN_OBJFILES)
	$(CC) $(CFLAGS) -o bin/idgen $(IDGEN_OBJFILES) $(LDFLAGS)

ping:
#ping: $(PING_OBJFILES)
#	$(CC) $(CFLAGS) -o bin/ping $(PING_OBJFILES) $(LDFLAGS)

router: $(ROUTER_OBJFILES)
	$(CC) $(CFLAGS) -o bin/router $(ROUTER_OBJFILES) $(LDFLAGS)

#mesh:
#	$(CC) $(CFLAGS) -o bin/mesh util/mesh.c src/*.c unix/util.c src/ext/*.c $(ARCH)

#port:
#	$(CC) $(CFLAGS) -o bin/port util/port.c src/*.c unix/util.c src/ext/*.c $(ARCH)

clean:
	rm -rf bin/*
	rm -f arduino/src/telehash/*.h
	rm -f arduino/src/telehash/*.c
	rm -f id.json
	cd test; $(MAKE) clean
	find . -name "*.o" -exec rm -f {} \;
	rm -f lib*.a

<MSG> see if this makes travis happy

<DFF> @@ -67,6 +67,7 @@ arduino: static
 	cp $(HEADERS) arduino/src/telehash/
 
 test: $(FULL_OBJFILES)
+	npm install
 	cd test; $(MAKE) $(MFLAGS)
 
 %.o : %.c $(HEADERS)

{'commit': 'diff --git a/Makefile b/Makefile\nindex 231cac1..731ded4 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -67,6 +67,7 @@ arduino: static\n \tcp $(HEADERS) arduino/src/telehash/\n \n test: $(FULL_OBJFILES)\n+\tnpm install\n \tcd test; $(MAKE) $(MFLAGS)\n \n %.o : %.c $(HEADERS)\n', 'commit_subject': 'see if this makes travis happy', 'repo_name': 'telehash/telehash-c', 'committer': {'name': 'Jeremie Miller', 'email': 'aa5d8c8bb73d4465608582ffc8dcd3cb76639f53@jabber.org', 'time_sec': '1420171102', 'tz_offset': '-360', 'date': {'seconds': '1420171102'}}, 'commit_tree': 'ca13c61ef3a6d6b275eaa8d3fbb86434b9dd1a4a', 'commit_message': 'see if this makes travis happy\n', 'language_name': 'C', 'license': 'mit', 'hunks': '@@ -67,6 +67,7 @@ arduino: static\n \tcp $(HEADERS) arduino/src/telehash/\n \n test: $(FULL_OBJFILES)\n+\tnpm install\n \tcd test; $(MAKE) $(MFLAGS)\n \n %.o : %.c $(HEADERS)\n', 'addition_count': 1, 'deletion_count': 0, 'src_file': 'a/Makefile', 'tgt_file': 'b/Makefile', 'file_extension': '', 'before_file': 'CC=gcc\nEMCC=emcc\nCFLAGS+=-g -std=c99 -std=gnu99 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DDEBUG -D_GNU_SOURCE\n#CFLAGS+=-Weverything -Wno-unused-macros -Wno-undef -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-gnu-label-as-value -Wno-gnu-designator -Wno-missing-prototypes -Wno-format-nonliteral\nINCLUDE+=-Iinclude -Iinclude/lib -Iunix -Ithrowback\n\nLIB = src/lib/lob.c src/lib/hashname.c src/lib/xht.c src/lib/js0n.c src/lib/base32.c src/lib/chacha.c src/lib/murmur.c src/lib/jwt.c src/lib/base64.c src/lib/aes128.c src/lib/sha256.c src/lib/uECC.c\nE3X = src/e3x/e3x.c src/e3x/self.c src/e3x/exchange.c src/e3x/cipher.c\nMESH = src/mesh.c src/link.c src/chan.c\nEXT = \n#NET = src/net/loopback.c src/net/udp4.c src/net/tcp4.c src/net/serial.c\nNET = src/net/loopback.c \nUTIL = src/util/util.c src/util/chunks.c src/util/frames.c src/unix/util.c src/unix/util_sys.c\nTHROWBACK = throwback/all.c throwback/lob.c throwback/xform.c throwback/xform_hex.c\n\n# CS1c by default\nCS = src/e3x/cs1c/cs1c.c \n\n# check for CS3a deps\nifneq ("$(wildcard node_modules/libsodium-c/src/libsodium/.libs/libsodium.a)","")\nCS += src/e3x/cs3a/cs3a.c\nLDFLAGS += node_modules/libsodium-c/src/libsodium/.libs/libsodium.a\nINCLUDE += -I./node_modules/libsodium-c/src/libsodium/include\nelse\nCS += src/e3x/cs3a_disabled.c\nendif\n\nLIB_OBJFILES = $(patsubst %.c,%.o,$(LIB))\nE3X_OBJFILES = $(patsubst %.c,%.o,$(E3X))\nMESH_OBJFILES = $(patsubst %.c,%.o,$(MESH))\nEXT_OBJFILES = $(patsubst %.c,%.o,$(EXT))\nNET_OBJFILES = $(patsubst %.c,%.o,$(NET))\nUTIL_OBJFILES = $(patsubst %.c,%.o,$(UTIL))\nCS_OBJFILES = $(patsubst %.c,%.o,$(CS))\nTB_OBJFILES = $(patsubst %.c,%.o,$(THROWBACK))\n\nFULL_OBJFILES = $(LIB_OBJFILES) $(E3X_OBJFILES) $(MESH_OBJFILES) $(EXT_OBJFILES) $(NET_OBJFILES) $(UTIL_OBJFILES) $(CS_OBJFILES)\n\nIDGEN_OBJFILES = $(FULL_OBJFILES) util/idgen.o\nROUTER_OBJFILES = $(FULL_OBJFILES) src/net/udp4.o util/router.o \nPING_OBJFILES = $(FULL_OBJFILES) util/ping.o \n\nHEADERS=$(wildcard include/*.h)\n\nall: idgen ping static\n\t@echo "TODO\\t`git grep TODO | wc -l | tr -d \' \'`"\n\ndeps:\n\tnpm install\n\n# todo, this header mangling process is a drag\n\nstatic: libtelehash\n\t@cat $(LIB) $(E3X) $(MESH) $(EXT) $(UTIL) > telehash.c\n\t@cat include/lob.h include/xht.h include/e3x_cipher.h include/e3x_self.h include/e3x_exchange.h include/hashname.h include/mesh.h include/link.h include/chan.h include/util_chunks.h include/util_frames.h include/*.h > telehash.h\n\t@sed -i.bak "/#include \\".*h\\"/d" telehash.h\n\t@rm -f telehash.h.bak\n\nstatic-cs1c:\n\t@echo "#include <telehash.h>" > telehash.c\n\t@cat $(LIB) $(E3X) $(MESH) $(EXT) $(UTIL) src/e3x/cs1c/cs1c.c src/e3x/cs3a_disabled.c >> telehash.c\n\t@sed -i \'\' "/#include \\".*h\\"/d" telehash.c\n\t@cat include/lob.h include/xht.h include/e3x_cipher.h include/e3x_self.h include/e3x_exchange.h include/hashname.h include/mesh.h include/link.h include/chan.h include/util_chunks.h include/util_frames.h include/*.h > telehash.h\n\t@sed -i.bak "/#include \\".*h\\"/d" telehash.h\n\t@rm -f telehash.h.bak\n\n\tcp $(HEADERS) arduino/src/telehash/\n\ntest: $(FULL_OBJFILES)\n\tcd test; $(MAKE) $(MFLAGS)\n\n%.o : %.c $(HEADERS)\n\nlibtelehash: $(FULL_OBJFILES)\n\trm -f libtelehash.a\n\tar crs libtelehash.a $(FULL_OBJFILES)\n\nthrowback-update:\n\tcd ../throwback && make static\n\tcp ../throwback/dew.c throwback/\n\tcp ../throwback/dew.h throwback/\n\nthrowback-test: $(FULL_OBJFILES) $(TB_OBJFILES)\n\t$(CC) $(CFLAGS) $(INCLUDE) -o test/bin/test_throwback throwback/test.c throwback/dew.c $(TB_OBJFILES) $(FULL_OBJFILES) $(LDFLAGS)\n\t./test/bin/test_throwback\n\n.PHONY: arduino test TAGS\n\ntest: $(FULL_OBJFILES) ping\n\tcd test; $(MAKE) $(MFLAGS)\n\nTAGS:\n\tfind . | grep ".*\\.\\(h\\|c\\)" | xargs etags -f TAGS\n\n%.o : %.c $(HEADERS)\n\t$(CC) $(INCLUDE) $(CFLAGS) -c $< -o $@\n\nidgen: $(IDGEN_OBJFILES)\n\t$(CC) $(CFLAGS) -o bin/idgen $(IDGEN_OBJFILES) $(LDFLAGS)\n\nping:\n#ping: $(PING_OBJFILES)\n#\t$(CC) $(CFLAGS) -o bin/ping $(PING_OBJFILES) $(LDFLAGS)\n\nrouter: $(ROUTER_OBJFILES)\n\t$(CC) $(CFLAGS) -o bin/router $(ROUTER_OBJFILES) $(LDFLAGS)\n\n#mesh:\n#\t$(CC) $(CFLAGS) -o bin/mesh util/mesh.c src/*.c unix/util.c src/ext/*.c $(ARCH)\n\n#port:\n#\t$(CC) $(CFLAGS) -o bin/port util/port.c src/*.c unix/util.c src/ext/*.c $(ARCH)\n\nclean:\n\trm -rf bin/*\n\trm -f arduino/src/telehash/*.h\n\trm -f arduino/src/telehash/*.c\n\trm -f id.json\n\tcd test; $(MAKE) clean\n\tfind . -name "*.o" -exec rm -f {} \\;\n\trm -f lib*.a\n', 'message': 'see if this makes travis happy\n', 'author_name': 'Jeremie Miller', 'lang': 'Makefile'}