-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (35 loc) · 991 Bytes
/
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
50
51
#!/usr/bin/make
all_proxy: all
VERSION=0.0.1
# Toolchain programs.
CC=gcc
LD=ld
AR=ar
LN=ln
# Directories.
SRC=src
INC=src/include
# Source and header files.
SRC_OBJS=test schematic vec schemfile block
INC_OBJS=schematic vec schemfile block
OBJ_PATHS=$(addprefix $(SRC)/, $(addsuffix .o, $(SRC_OBJS)))
SRC_PATHS=$(addprefix $(SRC)/, $(addsuffix .cpp, $(SRC_OBJS)))
INC_PATHS=$(addprefix $(INC)/, $(addsuffix .h, $(INC_OBJS)))
# Compiler flags.
CCFLAGS=-I$(INC) -g -Wall -Wextra -Wno-unused-parameter -Wformat -Wpedantic --std=gnu99
# Default rule for compiling object files.
%.o: %.c $(INC_PATHS)
$(CC) $(CCFLAGS) -fPIC -c $< -o $@
# Rule for compiling main executable.
test: $(OBJ_PATHS)
$(CC) -static -L/usr/local/include/nbt/ -g $^ -lnbt -lz -o $@
# Main rule.
all: test
# Lib shit yo
lib.so: $(OBJ_PATHS)
$(CC) -shared -fPIC -L/usr/local/include/nbt -g $^ -lnbt -lz -o $@
cp $@ python/lib.so
# Clean repo.
clean:
rm -f $(OBJ_PATHS) test
.PHONY: all_proxy all clean