-
Notifications
You must be signed in to change notification settings - Fork 6
/
makefile.linux
46 lines (33 loc) · 1.06 KB
/
makefile.linux
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
# linux makefile, graciously provided by strtok (https://github.com/taurreco on GitHub)
# you need to run as 'make all', plain 'make' won't build it properly
CC = gcc
CFLAGS = -O3
LIBS = -lX11 -lXext
BIN_DIR = bin
EXECS = main
EXECS_DEPS: $(BIN_DIR)/libpl.o $(BIN_DIR)/libfw.o
LIBFW = $(BIN_DIR)/libfw.o
LIBPL = $(BIN_DIR)/libpl.o
LIBFW_DEPS = $(addprefix $(BIN_DIR)/, pkb.o sys.o wvid.o xvid.o)
LIBPL_DEPS = $(addprefix $(BIN_DIR)/, clip.o gfx.o imode.o importer.o math.o pl.o)
all: $(BIN_DIR) $(EXECS)
$(BIN_DIR):
echo "[make] making bin directory"
mkdir -p $@
$(LIBFW_DEPS): $(BIN_DIR)/%.o: fw/%.c fw/fw.h
$(CC) $(CFLAGS) -c $< -o $@
$(LIBPL_DEPS): $(BIN_DIR)/%.o: main.c pl/%.c pl/pl.h
$(CC) $(CFLAGS) -c $< -o $@
$(LIBFW): $(LIBFW_DEPS)
ld -r -o $@ $(LIBFW_DEPS)
$(LIBPL): $(LIBPL_DEPS)
ld -r -o $@ $(LIBPL_DEPS)
$(EXECS): %: pl/pl.h fw/fw.h $(LIBPL) $(LIBFW)
$(CC) $(CFLAGS) $< -o $@ $(LIBPL) $(LIBFW) $(LIBS)
clean:
echo "[make] deleting bin directory"
rm -r $(BIN_DIR)
echo "[make] deleting executables"
for exec in $(EXECS) ; do \
rm $$exec ; \
done