mirror of
https://github.com/stupidcomputer/jsfw.git
synced 2024-12-27 05:47:37 -06:00
39 lines
639 B
Makefile
39 lines
639 B
Makefile
Q=@
|
|
CC=gcc
|
|
CFLAGS=-g -Wall -Wno-format-truncation -pthread
|
|
LDFLAGS=
|
|
BUILD_DIR=./objects
|
|
BIN=jsfw
|
|
|
|
RUNARGS=client localhost 7776
|
|
|
|
SOURCES=$(wildcard *.c)
|
|
|
|
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)
|
|
|