Makefile 642 B

1234567891011121314151617181920212223242526272829303132333435
  1. CC = gcc
  2. CFLAGS = -Wall -Werror -Wextra -g -std=c99
  3. LDFLAGS = -lreadline
  4. OBJ_DIR = build/obj
  5. SRC_DIR = src
  6. OUT_DIR = build
  7. OUT_NAME = gen-bindings
  8. OUT = $(OUT_DIR)/$(OUT_NAME)
  9. _OBJS = main.c.o
  10. OBJS = $(patsubst %,$(OBJ_DIR)/%,$(_OBJS))
  11. .PHONY: all
  12. all: directories $(OBJS)
  13. $(CC) $(LDFLAGS) $(OBJS) -o $(OUT)
  14. cp $(OUT) .
  15. run: all
  16. ./$(OUT) -o ../lua_generated_bindings -i description/bindings.desc
  17. $(OBJ_DIR)/%.c.o: $(SRC_DIR)/%.c
  18. $(CC) $(CFLAGS) -c $< -o $@
  19. .PHONY: directories
  20. directories:
  21. mkdir -p $(OUT_DIR)
  22. mkdir -p $(OBJ_DIR)
  23. .PHONY: clean
  24. clean:
  25. rm -rf $(OBJ_DIR)/*c.o
  26. rm -rf $(OUT_DIR)
  27. rm -rf $(OUT)
  28. rm -rf $(OUT_NAME)