jsfw/Makefile

39 lines
656 B
Makefile
Raw Normal View History

2022-08-27 19:29:43 -05:00
Q=@
CC=gcc
CFLAGS=-g -Wall -Wno-format-truncation -pthread -lm
LDFLAGS=-lm
2022-08-29 17:27:03 -05:00
BUILD_DIR=./objects
2022-08-27 19:29:43 -05:00
BIN=jsfw
2022-08-29 17:27:03 -05:00
RUNARGS=client localhost 7776
2022-08-27 19:29:43 -05:00
2022-08-29 17:27:03 -05:00
SOURCES=$(wildcard *.c)
2022-08-27 19:29:43 -05:00
OBJECTS:=$(patsubst %.c,$(BUILD_DIR)/%.o,$(SOURCES))
.PHONY: run
run: $(BIN)
@echo "RUN $(BIN) $(RUNARGS)"
$(Q) chmod +x $(BIN)
$(Q) ./$(BIN) $(RUNARGS)
$(BIN): $(OBJECTS)
@echo "LD $@"
$(Q) $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
2022-08-27 19:29:43 -05:00
$(BUILD_DIR)/%.o: %.c | $(BUILD_DIR)
@echo "CC $<"
$(Q) $(CC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(BUILD_DIR)
$(BUILD_DIR):
@echo "MKDIR"
$(Q) mkdir -p $(BUILD_DIR)
.PHONY: clean
clean:
@echo "CLEAN"
$(Q) rm -fr $(BUILD_DIR)
$(Q) rm -fr $(BIN)