protoverse

A metaverse protocol
git clone git://jb55.com/protoverse
Log | Files | Refs | README | LICENSE

Makefile (1438B)


      1 
      2 CFLAGS = -O2 -g -std=gnu90 -Wall -Wextra -Werror \
      3 	 -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes \
      4 	 -Wmissing-declarations -Wdeclaration-after-statement -fno-stack-protector \
      5 	 -Wno-unused-function 
      6 
      7 LDFLAGS = -lm
      8 
      9 OBJS = src/io.o \
     10        src/parse.o \
     11        src/describe.o \
     12        src/serve.o \
     13        src/client.o \
     14        src/net.o \
     15        src/varint.o \
     16        src/error.o \
     17        src/wasm.o
     18 
     19 SRCS=$(OBJS:.o=.c)
     20 
     21 WASMS = wasm/hello-c.wasm \
     22 	wasm/hello.wasm
     23 
     24 all: protoverse bench test libprotoverse.a
     25 
     26 noinline: CFLAGS += -DNOINLINE
     27 noinline: all
     28 
     29 debug: CFLAGS += -DDEBUG
     30 debug: all
     31 
     32 wasm: $(WASMS)
     33 
     34 %.o: %.c %.h
     35 	@echo "cc $<"
     36 	@$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
     37 
     38 %.wasm: %.wat
     39 	wat2wasm $^ -o $@
     40 
     41 %.c.wasm: %.wasm.c
     42 	emcc -g $< -s WASM=1 -o $@
     43 
     44 wasm/hello-c.wasm: wasm/hello-c.c
     45 	emcc -g $< -s WASM=1 -o $@
     46 
     47 protoverse.wasm: src/protoverse.c $(SRCS)
     48 	emcc -g $^ -s WASM=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -o $@
     49 
     50 protoverse: src/protoverse.c $(OBJS)
     51 	@echo "ld $@"
     52 	@$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
     53 
     54 libprotoverse.a: $(OBJS)
     55 	ar rcs $@ $^
     56 
     57 bench: src/bench.c $(OBJS)
     58 	@echo "ld $@"
     59 	@$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
     60 
     61 clean:
     62 	rm -f protoverse test $(OBJS) libprotoverse.a
     63 
     64 test: src/test.c $(OBJS)
     65 	@echo "ld $@"
     66 	@$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
     67 
     68 check: test protoverse
     69 	@./test
     70 	./runtests
     71 
     72 tags: fake
     73 	ctags src/*.c src/*.h > $@
     74 
     75 TAGS: fake
     76 	etags src/*.c src/*.h > $@
     77 
     78 
     79 .PHONY: fake