b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | --- a/C/LzmaUtil/makefile.gcc |
| 2 | +++ b/C/LzmaUtil/makefile.gcc |
| 3 | @@ -1,44 +1,53 @@ |
| 4 | PROG = lzma |
| 5 | -CXX = g++ |
| 6 | -LIB = |
| 7 | +CC = gcc |
| 8 | +LIB = liblzma.a |
| 9 | RM = rm -f |
| 10 | CFLAGS = -c -O2 -Wall |
| 11 | +AR = ar |
| 12 | +RANLIB = ranlib |
| 13 | |
| 14 | OBJS = \ |
| 15 | - LzmaUtil.o \ |
| 16 | Alloc.o \ |
| 17 | LzFind.o \ |
| 18 | LzmaDec.o \ |
| 19 | LzmaEnc.o \ |
| 20 | + LzmaLib.o \ |
| 21 | 7zFile.o \ |
| 22 | 7zStream.o \ |
| 23 | |
| 24 | - |
| 25 | all: $(PROG) |
| 26 | |
| 27 | -$(PROG): $(OBJS) |
| 28 | - $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2) |
| 29 | +$(PROG): LzmaUtil.o $(LIB) |
| 30 | + $(CC) -o $(PROG) $(LDFLAGS) $< $(LIB) |
| 31 | |
| 32 | LzmaUtil.o: LzmaUtil.c |
| 33 | - $(CXX) $(CFLAGS) LzmaUtil.c |
| 34 | + $(CC) $(CFLAGS) LzmaUtil.c |
| 35 | + |
| 36 | +$(LIB): $(OBJS) |
| 37 | + rm -f $@ |
| 38 | + $(AR) rcu $@ $(OBJS) |
| 39 | + $(RANLIB) $@ |
| 40 | |
| 41 | Alloc.o: ../Alloc.c |
| 42 | - $(CXX) $(CFLAGS) ../Alloc.c |
| 43 | + $(CC) $(CFLAGS) ../Alloc.c |
| 44 | |
| 45 | LzFind.o: ../LzFind.c |
| 46 | - $(CXX) $(CFLAGS) ../LzFind.c |
| 47 | + $(CC) $(CFLAGS) ../LzFind.c |
| 48 | |
| 49 | LzmaDec.o: ../LzmaDec.c |
| 50 | - $(CXX) $(CFLAGS) ../LzmaDec.c |
| 51 | + $(CC) $(CFLAGS) ../LzmaDec.c |
| 52 | |
| 53 | LzmaEnc.o: ../LzmaEnc.c |
| 54 | - $(CXX) $(CFLAGS) ../LzmaEnc.c |
| 55 | + $(CC) $(CFLAGS) ../LzmaEnc.c |
| 56 | + |
| 57 | +LzmaLib.o: ../LzmaLib.c |
| 58 | + $(CC) $(CFLAGS) ../LzmaLib.c |
| 59 | |
| 60 | 7zFile.o: ../7zFile.c |
| 61 | - $(CXX) $(CFLAGS) ../7zFile.c |
| 62 | + $(CC) $(CFLAGS) ../7zFile.c |
| 63 | |
| 64 | 7zStream.o: ../7zStream.c |
| 65 | - $(CXX) $(CFLAGS) ../7zStream.c |
| 66 | + $(CC) $(CFLAGS) ../7zStream.c |
| 67 | |
| 68 | clean: |
| 69 | - -$(RM) $(PROG) $(OBJS) |
| 70 | + -$(RM) $(PROG) *.o *.a |