2022-08-27 19:29:43 -05:00
|
|
|
Q=@
|
|
|
|
CC=gcc
|
2022-08-31 16:24:26 -05:00
|
|
|
CFLAGS=-g -Wall -Wno-format-truncation -pthread -lm
|
2022-08-27 19:29:43 -05:00
|
|
|
LDFLAGS=
|
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 $@"
|
2022-08-31 11:54:14 -05:00
|
|
|
$(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)
|
|
|
|
|