wrapper/Makefile

50 lines
796 B
Makefile
Raw 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)
.PHONY: clean build
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:
cp bin/app /usr/local/bin/wrapper
uninstall:
rm /usr/local/bin/wrapper
openrc-install: install
cp service/openrc /etc/init.d/wrapper
chmod +x /etc/init.d/wrapper
openrc-uninstall: uninstall
rm /etc/init.d/wrapper