Makefile (1482B)
1 2 BIN = lnvis 3 PREFIX ?= /usr/local 4 CFLAGS = -Ideps -ggdb -O2 -Wall -Wextra -std=c99 -DJSMN_PARENT_LINKS \ 5 $(shell pkg-config --cflags glfw3) \ 6 $(EXTRA_CFLAGS) 7 8 LDFLAGS = $(EXTRA_LDFLAGS) $(shell pkg-config --libs glfw3) -lm 9 10 ifeq ($(OS),Windows_NT) 11 CCFLAGS += -D WIN32 12 ifeq ($(PROCESSOR_ARCHITEW6432),AMD64) 13 CFLAGS += -D AMD64 14 else 15 ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) 16 CFLAGS += -D AMD64 17 endif 18 ifeq ($(PROCESSOR_ARCHITECTURE),x86) 19 CFLAGS += -D IA32 20 endif 21 endif 22 else 23 UNAME_S := $(shell uname -s) 24 ifeq ($(UNAME_S),Linux) 25 CFLAGS += -D LINUX 26 LDFLAGS += -lGL 27 endif 28 ifeq ($(UNAME_S),Darwin) 29 CCFLAGS += -D OSX 30 LDFLAGS += -framework OpenGL 31 endif 32 UNAME_P := $(shell uname -p) 33 ifeq ($(UNAME_P),x86_64) 34 CFLAGS += -D AMD64 35 endif 36 ifneq ($(filter %86,$(UNAME_P)),) 37 CFLAGS += -D IA32 38 endif 39 ifneq ($(filter arm%,$(UNAME_P)),) 40 CFLAGS += -D ARM 41 endif 42 endif 43 44 SRCS = main.c 45 46 SRCS += update.c 47 SRCS += ln.c 48 SRCS += grid.c 49 SRCS += render.c 50 SRCS += perf.c 51 SRCS += json.c 52 SRCS += demo.c 53 SRCS += options.c 54 SRCS += $(wildcard deps/*.c) 55 SRCS += $(wildcard deps/*/*.c) 56 57 OBJS = $(SRCS:.c=.o) 58 59 all: $(BIN) 60 61 %.d: %.c 62 $(CC) -MM $(CFLAGS) $< > $@ 63 64 include $(OBJS:.o=.d) 65 66 67 $(BIN): $(OBJS) 68 $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@ 69 70 TAGS: fake 71 etags $(SRCS) 72 73 format: fake 74 clang-format -i *.c 75 76 clean: fake 77 rm -f $(OBJS) *.d 78 79 .PHONY: fake