Skip to content

Commit 235fd72

Browse files
committed
Removed obsolete MinGW Makefile rules, removed link to libdl (-ldl) as it
is now part of glibc, added rules for compiling on Windows (under Cygwin MinGW etc).
1 parent 80246fe commit 235fd72

File tree

2 files changed

+8
-95
lines changed

2 files changed

+8
-95
lines changed

Makefile

Lines changed: 7 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ SHAREDSUFFIX = .dylib
1919
CC = /usr/bin/gcc
2020
CPPFLAGS += -I/opt/local/include -L/opt/local/lib
2121
BIN2O = /usr/bin/ld -r -arch x86_64
22+
else ifeq ($(OS),Windows_NT)
23+
SHARED = -shared
24+
SHAREDSUFFIX = .dll
2225
else
2326
SHARED = -shared
2427
SHAREDSUFFIX = .so
2528
endif
2629

27-
2830
PACKERS = zlib-packer lzo-packer n2b-packer n2d-packer n2e-packer null-packer
2931

3032
all: ps2-packer packers stubs
@@ -39,7 +41,7 @@ install: all
3941
PREFIX=$(PREFIX) $(SUBMAKE) stub install
4042

4143
ps2-packer: ps2-packer.c dlopen.c
42-
$(CC) $(CPPFLAGS) ps2-packer.c dlopen.c -o ps2-packer -ldl
44+
$(CC) $(CPPFLAGS) ps2-packer.c dlopen.c -o ps2-packer
4345

4446
ps2-packer-lite: ps2-packer.c builtin_stub_one.o builtin_stub.o
4547
$(CC) $(CPPFLAGS) -DPS2_PACKER_LITE ps2-packer.c n2e-packer.c $(LIBUCLA) builtin_stub_one.o builtin_stub.o -o ps2-packer-lite
@@ -88,7 +90,7 @@ stubs-dist:
8890
$(SUBMAKE) stub dist
8991

9092
clean:
91-
rm -f ps2-packer ps2-packer-lite ps2-packer.exe ps2-packer-lite.exe *.zip *.gz *.dll *$(SHAREDSUFFIX) *.o mingw-builtin_stub_one.h mingw-builtin_stub.h
93+
rm -f ps2-packer ps2-packer-lite ps2-packer.exe ps2-packer-lite.exe *.zip *.gz *.dll *$(SHAREDSUFFIX) *.o
9294
$(SUBMAKE) stub clean
9395
rm -f stubs-tag.stamp
9496

@@ -100,106 +102,17 @@ rebuild: clean all
100102
# Everything below is for me, building the distribution packages.
101103
#
102104

103-
mingw: ps2-packer.exe ps2-packer-lite.exe mingw-packers
104-
105-
MINGW_LIBGCC = -lgcc
106-
#/usr/lib/gcc-lib/i586-mingw32msvc/2.95.3-7/libgcc.a
107-
108-
ps2-packer.exe: ps2-packer.c dlopen.c
109-
i586-mingw32msvc-gcc $(CPPFLAGS) ps2-packer.c dlopen.c -o ps2-packer.exe -I mingw-getopt mingw-getopt/getopt*.c
110-
111-
ps2-packer-lite.exe: ps2-packer.c n2e-packer.c mingw-ucl mingw-ucl mingw-builtin_stub_one.h mingw-builtin_stub.h
112-
i586-mingw32msvc-gcc $(CPPFLAGS) -DPS2_PACKER_LITE ps2-packer.c n2e-packer.c -o ps2-packer-lite.exe -I mingw-getopt -I mingw-ucl mingw-getopt/getopt*.c mingw-ucl/ucl.a
113-
114-
mingw-builtin_stub_one.h: stubs-tag.stamp
115-
/usr/local/ps2dev/ps2sdk/bin/bin2c stub/n2e-asm-one-1d00-stub mingw-builtin_stub_one.h _binary_b_stub_one_start
116-
117-
mingw-builtin_stub.h: stubs-tag.stamp
118-
/usr/local/ps2dev/ps2sdk/bin/bin2c stub/n2e-asm-1d00-stub mingw-builtin_stub.h _binary_b_stub_start
119-
120-
mingw-packers: $(addsuffix .dll,$(PACKERS))
121-
122-
mingw-zlib:
123-
make -C mingw-zlib
124-
125-
mingw-ucl:
126-
make -C mingw-ucl
127-
128-
mingw-clean:
129-
make -C mingw-zlib clean
130-
make -C mingw-ucl clean
131-
132-
dllinit.o: dllinit.c
133-
i586-mingw32msvc-gcc -c dllinit.c
134-
135-
zlib-packer.dll: zlib-packer.c mingw-zlib dllinit.o
136-
i586-mingw32msvc-gcc -c zlib-packer.c -I mingw-zlib
137-
echo EXPORTS > tmp.def
138-
i586-mingw32msvc-nm zlib-packer.o dllinit.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> tmp.def
139-
i586-mingw32msvc-ld --base-file tmp.base --dll -o zlib-packer.dll zlib-packer.o dllinit.o -e _DllMain@12 mingw-zlib/zlib.a -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
140-
i586-mingw32msvc-dlltool --dllname zlib-packer.dll --def tmp.def --base-file tmp.base --output-exp tmp.exp
141-
i586-mingw32msvc-ld --base-file tmp.base tmp.exp --dll -o zlib-packer.dll zlib-packer.o dllinit.o -e _DllMain@12 mingw-zlib/zlib.a -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
142-
rm tmp.base tmp.exp tmp.def zlib-packer.o
143-
144-
lzo-packer.dll: lzo-packer.c dllinit.o
145-
i586-mingw32msvc-gcc -c lzo-packer.c minilzo.c
146-
echo EXPORTS > tmp.def
147-
i586-mingw32msvc-nm lzo-packer.o dllinit.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> tmp.def
148-
i586-mingw32msvc-ld --base-file tmp.base --dll -o lzo-packer.dll lzo-packer.o minilzo.o dllinit.o -e _DllMain@12 -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
149-
i586-mingw32msvc-dlltool --dllname lzo-packer.dll --def tmp.def --base-file tmp.base --output-exp tmp.exp
150-
i586-mingw32msvc-ld --base-file tmp.base tmp.exp --dll -o lzo-packer.dll lzo-packer.o minilzo.o dllinit.o -e _DllMain@12 -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
151-
rm tmp.base tmp.exp tmp.def lzo-packer.o minilzo.o
152-
153-
n2b-packer.dll: n2b-packer.c mingw-ucl dllinit.o
154-
i586-mingw32msvc-gcc -c n2b-packer.c -I mingw-ucl
155-
echo EXPORTS > tmp.def
156-
i586-mingw32msvc-nm n2b-packer.o dllinit.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> tmp.def
157-
i586-mingw32msvc-ld --base-file tmp.base --dll -o n2b-packer.dll n2b-packer.o dllinit.o -e _DllMain@12 mingw-ucl/ucl.a -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
158-
i586-mingw32msvc-dlltool --dllname n2b-packer.dll --def tmp.def --base-file tmp.base --output-exp tmp.exp
159-
i586-mingw32msvc-ld --base-file tmp.base tmp.exp --dll -o n2b-packer.dll n2b-packer.o dllinit.o -e _DllMain@12 mingw-ucl/ucl.a -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
160-
rm tmp.base tmp.exp tmp.def n2b-packer.o
161-
162-
n2d-packer.dll: n2d-packer.c mingw-ucl dllinit.o
163-
i586-mingw32msvc-gcc -c n2d-packer.c -I mingw-ucl
164-
echo EXPORTS > tmp.def
165-
i586-mingw32msvc-nm n2d-packer.o dllinit.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> tmp.def
166-
i586-mingw32msvc-ld --base-file tmp.base --dll -o n2d-packer.dll n2d-packer.o dllinit.o -e _DllMain@12 mingw-ucl/ucl.a -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
167-
i586-mingw32msvc-dlltool --dllname n2d-packer.dll --def tmp.def --base-file tmp.base --output-exp tmp.exp
168-
i586-mingw32msvc-ld --base-file tmp.base tmp.exp --dll -o n2d-packer.dll n2d-packer.o dllinit.o -e _DllMain@12 mingw-ucl/ucl.a -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
169-
rm tmp.base tmp.exp tmp.def n2d-packer.o
170-
171-
n2e-packer.dll: n2e-packer.c mingw-ucl dllinit.o
172-
i586-mingw32msvc-gcc -c n2e-packer.c -I mingw-ucl
173-
echo EXPORTS > tmp.def
174-
i586-mingw32msvc-nm n2e-packer.o dllinit.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> tmp.def
175-
i586-mingw32msvc-ld --base-file tmp.base --dll -o n2e-packer.dll n2e-packer.o dllinit.o -e _DllMain@12 mingw-ucl/ucl.a -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
176-
i586-mingw32msvc-dlltool --dllname n2e-packer.dll --def tmp.def --base-file tmp.base --output-exp tmp.exp
177-
i586-mingw32msvc-ld --base-file tmp.base tmp.exp --dll -o n2e-packer.dll n2e-packer.o dllinit.o -e _DllMain@12 mingw-ucl/ucl.a -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
178-
rm tmp.base tmp.exp tmp.def n2e-packer.o
179-
180-
null-packer.dll: null-packer.c dllinit.o
181-
i586-mingw32msvc-gcc -c null-packer.c
182-
echo EXPORTS > tmp.def
183-
i586-mingw32msvc-nm null-packer.o dllinit.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> tmp.def
184-
i586-mingw32msvc-ld --base-file tmp.base --dll -o null-packer.dll null-packer.o dllinit.o -e _DllMain@12 -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
185-
i586-mingw32msvc-dlltool --dllname null-packer.dll --def tmp.def --base-file tmp.base --output-exp tmp.exp
186-
i586-mingw32msvc-ld --base-file tmp.base tmp.exp --dll -o null-packer.dll null-packer.o dllinit.o -e _DllMain@12 -lmingw32 -lkernel32 -lmoldname -lmsvcrt $(MINGW_LIBGCC)
187-
rm tmp.base tmp.exp tmp.def null-packer.o
188-
189-
dist: all mingw COPYING stubs-dist README.txt ps2-packer.c $(addsuffix .c,$(PACKERS))
105+
dist: all COPYING stubs-dist README.txt ps2-packer.c $(addsuffix .c,$(PACKERS))
190106
strip ps2-packer ps2-packer-lite $(addsuffix $(SHAREDSUFFIX),$(PACKERS))
191-
i586-mingw32msvc-strip ps2-packer.exe ps2-packer-lite.exe $(addsuffix .dll,$(PACKERS))
192107
upx-nrv --best ps2-packer ps2-packer-lite ps2-packer.exe ps2-packer-lite.exe $(addsuffix .dll,$(PACKERS))
193108
tar cvfz ps2-packer-$(VERSION)-linux.tar.gz ps2-packer $(addsuffix $(SHAREDSUFFIX),$(PACKERS)) COPYING stub/*stub README.txt
194109
zip -9 ps2-packer-$(VERSION)-win32.zip ps2-packer.exe $(addsuffix .dll,$(PACKERS)) COPYING stub/*stub README.txt
195110
tar cvfz ps2-packer-lite-$(VERSION)-linux.tar.gz ps2-packer-lite COPYING README.txt README-lite.txt
196111
zip -9 ps2-packer-lite-$(VERSION)-win32.zip ps2-packer-lite.exe COPYING README.txt README-lite.txt
197112
tar cvfz ps2-packer-$(VERSION)-src.tar.gz *.{c,h} Makefile COPYING stub/{Makefile,crt0.s,dummy.s,linkfile,*.{c,h,S}} stub/ucl/*.S stub/{zlib,lzo,ucl}/{Makefile,*.{c,h}} README.txt README-lite.txt
198113

199-
redist: clean mingw-clean dist
114+
redist: clean dist
200115

201116
release: redist
202117
rm -f /var/www/softwares/ps2-packer/*
203118
cp *.gz *.zip COPYING README.txt README-lite.txt /var/www/softwares/ps2-packer
204-
205-
.PHONY: mingw-zlib mingw-ucl

ps2-packer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ int main(int argc, char ** argv) {
796796
#endif
797797

798798
#ifndef PS2_PACKER_LITE
799-
printv("Opening packer.\n");
799+
printv("Opening packer %s.\n", packer_dll);
800800
packer_module = open_module(packer_dll);
801801
pack_section = get_symbol(packer_module, "pack_section");
802802
signature = get_symbol(packer_module, "signature");

0 commit comments

Comments
 (0)