wrapper/Makefile

52 lines
872 B
Makefile
Raw Permalink Normal View History

2023-04-06 03:08:09 +00:00
CC = gcc
INCFLAGS = -Isrc
2023-04-11 17:44:16 +00:00
CCFLAGS = -std=gnu99 -Wall -Wextra -pedantic -O2
2023-04-06 03:08:09 +00:00
CCFLAGS += $(INCFLAGS)
LDFLAGS += $(INCFLAGS)
2023-04-08 19:58:03 +00:00
LDFLAGS += -lpthread
2023-04-06 03:08:09 +00:00
BIN = bin
APP = $(BIN)/app
SRC = $(shell find src -name "*.c")
OBJ = $(SRC:%.c=$(BIN)/%.o)
2023-04-13 22:32:44 +00:00
.PHONY: dirs run clean build install uninstall install-openrc uninstall-openrc
EOF: clean build
2023-04-06 03:08:09 +00:00
dirs:
mkdir -p ./$(BIN)
mkdir -p ./$(BIN)/src
mkdir -p ./$(BIN)/src/io
mkdir -p ./$(BIN)/src/packet
mkdir -p ./$(BIN)/src/server
run: build
$(APP)
build: dirs ${OBJ}
${CC} -o $(APP) $(filter %.o,$^) $(LDFLAGS)
$(BIN)/%.o: %.c
$(CC) -o $@ -c $< $(CCFLAGS)
clean:
rm -rf $(APP)
rm -rf $(BIN)
install:
2023-04-13 02:30:54 +00:00
cp $(APP) /usr/local/bin/wrapper
uninstall:
rm /usr/local/bin/wrapper
2023-04-13 02:30:54 +00:00
install-openrc: install
cp service/openrc /etc/init.d/wrapper
chmod +x /etc/init.d/wrapper
2023-04-13 02:30:54 +00:00
uninstall-openrc: uninstall
rm /etc/init.d/wrapper