-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·60 lines (47 loc) · 1.6 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
50
51
52
53
54
55
56
57
58
59
60
.POSIX:
CC = cc
CFLAGS = -Wall -Werror -Wextra -Os
MKDIR = mkdir -p
FFLAGS =
ifeq ($(OS), Windows_NT)
LDFLAGS = -s -static
LDLIBS = -lpthread -lws2_32 -liphlpapi -ladvapi32 -lkernel32 -lshell32
PREFIX = %HOMEPATH%/parcel
EXE = .exe
parcel_res = $(build_dir)parcel.res
parceld_res =$(build_dir)parceld.res
RESCMD_PARCEL = windres.exe $(res_dir)parcel.rc -O coff -o $(parcel_res)
RESCMD_PARCELD = windres.exe $(res_dir)parceld.rc -O coff -o $(parceld_res)
else
LDFLAGS =
LDLIBS = -pthread
PREFIX = /usr/local
endif
src_dir = ./src/
build_dir = ./build/
res_dir = ./etc/resources/
parcel_dir = $(src_dir)parcel/
parceld_dir = $(src_dir)parceld/
parcel_source = $(src_dir)*.c $(parcel_dir)*.c
parceld_source = $(src_dir)*.c $(parceld_dir)*.c
parcel_all = $(src_dir)*.* $(parcel_dir)*.*
parceld_all = $(src_dir)*.* $(parceld_dir)*.*
parcel_includes = -I$(src_dir) -I$(parcel_dir)
parceld_includes = -I$(src_dir) -I$(parceld_dir)
all: resources parcel$(EXE) parceld$(EXE)
resources:
$(MKDIR) $(build_dir)
$(RESCMD_PARCEL)
$(RESCMD_PARCELD)
parcel$(EXE): $(parcel_all)
$(CC) $(CFLAGS) $(parcel_includes) $(parcel_source) $(parcel_res) -o $(build_dir)$@ $(LDLIBS) $(LDFLAGS) $(FFLAGS)
parceld$(EXE): $(parceld_all)
$(CC) $(CFLAGS) $(parceld_includes) $(parceld_source) $(parceld_res) -o $(build_dir)$@ $(LDLIBS) $(LDFLAGS) $(FFLAGS)
install: parcel parceld
install -m 755 $(build_dir)parcel$(EXE) $(PREFIX)/bin
install -m 755 $(build_dir)parceld$(EXE) $(PREFIX)/bin
clean:
rm -f $(build_dir)*
uninstall:
rm -f $(PREFIX)/bin/parcel$(EXE)
rm -f $(PREFIX)/bin/parceld$(EXE)