aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lzma/patches/100-static_library.patch
blob: 15ab4e0552b5b9429f4485aa2fc94e8352b7a813 (plain)
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
--- a/C/LzmaUtil/makefile.gcc
+++ b/C/LzmaUtil/makefile.gcc
@@ -1,44 +1,53 @@
 PROG = lzma
-CXX = g++
-LIB =
+CC = gcc
+LIB = liblzma.a
 RM = rm -f
 CFLAGS = -c -O2 -Wall
+AR = ar
+RANLIB = ranlib
 
 OBJS = \
-  LzmaUtil.o \
   Alloc.o \
   LzFind.o \
   LzmaDec.o \
   LzmaEnc.o \
+  LzmaLib.o \
   7zFile.o \
   7zStream.o \
 
-
 all: $(PROG)
 
-$(PROG): $(OBJS)
-	$(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2)
+$(PROG): LzmaUtil.o $(LIB)
+	$(CC) -o $(PROG) $(LDFLAGS) $< $(LIB)
 
 LzmaUtil.o: LzmaUtil.c
-	$(CXX) $(CFLAGS) LzmaUtil.c
+	$(CC) $(CFLAGS) LzmaUtil.c
+
+$(LIB): $(OBJS)
+	rm -f $@
+	$(AR) rcu $@ $(OBJS)
+	$(RANLIB) $@
 
 Alloc.o: ../Alloc.c
-	$(CXX) $(CFLAGS) ../Alloc.c
+	$(CC) $(CFLAGS) ../Alloc.c
 
 LzFind.o: ../LzFind.c
-	$(CXX) $(CFLAGS) ../LzFind.c
+	$(CC) $(CFLAGS) ../LzFind.c
 
 LzmaDec.o: ../LzmaDec.c
-	$(CXX) $(CFLAGS) ../LzmaDec.c
+	$(CC) $(CFLAGS) ../LzmaDec.c
 
 LzmaEnc.o: ../LzmaEnc.c
-	$(CXX) $(CFLAGS) ../LzmaEnc.c
+	$(CC) $(CFLAGS) ../LzmaEnc.c
+
+LzmaLib.o: ../LzmaLib.c
+	$(CC) $(CFLAGS) ../LzmaLib.c
 
 7zFile.o: ../7zFile.c
-	$(CXX) $(CFLAGS) ../7zFile.c
+	$(CC) $(CFLAGS) ../7zFile.c
 
 7zStream.o: ../7zStream.c
-	$(CXX) $(CFLAGS) ../7zStream.c
+	$(CC) $(CFLAGS) ../7zStream.c
 
 clean:
-	-$(RM) $(PROG) $(OBJS)
+	-$(RM) $(PROG) *.o *.a