protoverse

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

Makefile (1558B)


      1 
      2 CFLAGS = -O0 -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.wasm \
     22 	wasm/unresolved_br.wasm \
     23 	wasm/primal.wasm
     24 
     25 all: protoverse bench test libprotoverse.a wasm
     26 
     27 noinline: CFLAGS += -DNOINLINE
     28 noinline: all
     29 
     30 debug: CFLAGS += -DDEBUG
     31 debug: all
     32 
     33 wasm: $(WASMS)
     34 
     35 %.o: %.c %.h
     36 	@echo "cc $<"
     37 	@$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
     38 
     39 %.wasm: %.wat
     40 	wat2wasm $^ -o $@
     41 
     42 %.c.wasm: %.wasm.c
     43 	emcc -g $< -s WASM=1 -o $@
     44 
     45 wasm/primal.wasm: wasm/primal.ts wasm/nostr.ts
     46 	asc $< --outFile $@
     47 
     48 wasm/hello-c.wasm: wasm/hello-c.c
     49 	emcc -g $< -s WASM=1 -o $@
     50 
     51 protoverse.wasm: src/protoverse.c $(SRCS)
     52 	emcc -g $^ -s WASM=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -o $@
     53 
     54 protoverse: src/protoverse.c $(OBJS)
     55 	@echo "ld $@"
     56 	@$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
     57 
     58 libprotoverse.a: $(OBJS)
     59 	ar rcs $@ $^
     60 
     61 bench: src/bench.c $(OBJS)
     62 	@echo "ld $@"
     63 	@$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
     64 
     65 clean:
     66 	rm -f protoverse test/test $(OBJS) libprotoverse.a
     67 
     68 test/test: src/test.c $(OBJS)
     69 	@echo "ld $@"
     70 	@$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
     71 
     72 check: test/test protoverse
     73 	@./test/test
     74 	./runtests
     75 
     76 tags: fake
     77 	ctags src/*.c src/*.h > $@
     78 
     79 TAGS: fake
     80 	etags src/*.c src/*.h > $@
     81 
     82 
     83 .PHONY: fake