2022-08-27 19:29:43 -05:00
|
|
|
Q=@
|
|
|
|
CC=gcc
|
2022-08-30 17:54:56 -05:00
|
|
|
CFLAGS=-g -Wall -Wno-format-truncation -pthread -DJSFW_DEV
|
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 $@"
|
|
|
|
$(Q) $(CC) $(LDFLAGS) $^ -o $@
|
|
|
|
|
|
|
|
$(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)
|
|
|
|
|