-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (62 loc) · 1.54 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#
# This Makefile requires GNU Make
#
CC ?= cc
CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -maes
INSTALL = install -c
STRIP = strip
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
VERSION = 1.0
# add git revision if .git exists
ifeq (,$(wildcard .git))
CFLAGS += -DREVISION="unknown"
else
CFLAGS += -DREVISION="$(shell git rev-parse --short HEAD)"
endif
ifeq ($(DEBUG),1)
# for debugging
CFLAGS += -g -Wall -Werror
LDFLAGS += -pg
else
# for release
CFLAGS += -O2
endif
# we need to link to libc/msvcrt
ifeq ($(OS),Windows_NT)
CFLAGS += -DHAVE__ALIGNED_MALLOC
LDFLAGS += -lmsvcrt
else
CFLAGS += -DHAVE_POSIX_MEMALIGN
LDFLAGS += -lc
endif
RELDIR = drmdecrypt-$(VERSION)
##########################
SRC = AES.c AESNI.c drmdecrypt.c
OBJS = AES.o AESNI.o drmdecrypt.o
all: drmdecrypt
drmdecrypt: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS)
drmdecrypt-static: $(OBJS)
$(CC) $(LDFLAGS) -static -o $@ $(OBJS)
install: all
$(STRIP) drmdecrypt
$(INSTALL) drmdecrypt $(BINDIR)/drmdecrypt
release-win: all
rm -rf $(RELDIR)-win
mkdir $(RELDIR)-win
cp LICENSE README.md drmdecrypt.exe $(RELDIR)-win
$(STRIP) $(RELDIR)-win/*.exe
release-x64: drmdecrypt drmdecrypt-static
rm -rf $(RELDIR)-x64
mkdir $(RELDIR)-x64
cp LICENSE README.md drmdecrypt drmdecrypt-static $(RELDIR)-x64
tar cvfj $(RELDIR)-x64.tar.bz2 $(RELDIR)-x64
release-src:
rm -rf $(RELDIR)-src
mkdir $(RELDIR)-src
cp LICENSE README.md *.c *.h Makefile $(RELDIR)-src
tar cvfj $(RELDIR)-src.tar.bz2 $(RELDIR)-src
clean:
rm -f *.o *.core drmdecrypt drmdecrypt.exe
rm -rf $(RELDIR)