-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (36 loc) · 1.03 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
SRC_CLI = $(shell find ./local/ -name "*.c")
OBJ_CLI = $(patsubst %.c,%.o, $(SRC_CLI))
SRC_SER = $(shell find ./server/ -name "*.c")
OBJ_SER = $(patsubst %.c,%.o, $(SRC_SER))
TRG_CLI = ./cubebox
TRG_SER = ./cubebox-server
INSTALL_PATH=/usr/games/cubebox
BIN_DIR = /usr/bin/
CC = gcc
CP = cp
LN = ln
CHMOD = chmod
MKDIR = mkdir
CFLAGS = $(shell sdl-config --libs --cflags) -lGL -lGLU -Wall -lSDL_mixer -lm -lpthread -lrt -g
all: client server
client: $(OBJ_CLI)
$(CC) -o $(TRG_CLI) $(OBJ_CLI) $(CFLAGS)
server: $(OBJ_SER)
$(CC) -o $(TRG_SER) $(OBJ_SER) $(CFLAGS)
%.o:%.c
$(CC) -o $@ -c $< $(CFLAGS)
rebuild:
superclean
all
clean:
rm -rf $(OBJ_CLI) $(OBJ_SER) startcubebox
superclean : clean
rm -rf $(TRG_CLI) $(TRG_SER)
install: client server
$(MKDIR) $(INSTALL_PATH) -p
$(CP) $(TRG_CLI) res -r $(INSTALL_PATH)
$(CP) $(TRG_SER) res -r $(INSTALL_PATH)
sed 's|INSTALL_PATH|"${INSTALL_PATH}"|g' cubebox.sh > startcubebox
$(CP) startcubebox $(BIN_DIR)/cubebox
$(CHMOD) 755 $(BIN_DIR)/cubebox
$(CHMOD) 755 $(INSTALL_PATH) -R