git » fp-git.git » commit ad68e66

some changes

author peter_k
2006-02-16 19:29:52 UTC
committer peter_k
2006-02-16 19:29:52 UTC
parent e7b54dbfa1a4c7f3afe9615a7347a707cb76494a

some changes

PR/src/Makefile.lcc +173 -118

diff --git a/PR/src/Makefile.lcc b/PR/src/Makefile.lcc
index 4abb5a1..b25d58c 100644
--- a/PR/src/Makefile.lcc
+++ b/PR/src/Makefile.lcc
@@ -2,28 +2,39 @@
 # Programs #
 ############
 
-CC         = @lc
-LINKER     = @lcclnk
+CC         = @gcc
+LINKER     = @ld
 INFO       = @echo
-MAKEDIR    = @mkdir
-REMOVER    = @del
+MAKEDIR    = @mkdir -p
+REMOVER    = @rm -f
 GZIP       = @gzip
+COPY       = @ln -f
 
 #####################
 # Operating Systems #
 #####################
 
-OS    = Win32
-LINUX = -DNOLINUX
-PORTS = getopt.obj getopt1.obj dirent.obj
+OS      := $(shell uname)
+ifeq ($(OS),Linux)
+  LINUX = -DLINUX
+  OS    = GNU\Linux
+  PORTS =
+else
+  LINUX = -DNOLINUX
+  PORTS = .getopt.obj .getopt1.obj
+	ifeq ($(OS),Darwin)
+		LINUX = -DNOLINUX -DMACOS
+	endif
+endif
 
 ####################
 # Compiler options #
 ####################
 
 #Libraries: include path and linked libs
-INCLUDE       = -Iinclude\\ 
-DEFINES       = $(LINUX)
+INCLUDE       = -Iinclude\
+LIBS          = 
+DEFINES       = -DOS=\"$(OS)\" $(LINUX)
 
 #Release type
 TYPE          = Debug
@@ -32,45 +43,51 @@ TYPE          = Debug
 #  -O2                             for release
 # LINKERRELEASE may be:
 #  -s                              for release
-RELEASE       = -ansic
-LINKERRELEASE = -s
-
-FILES    = import.obj export.obj idlist.obj autodetect.obj classify.obj disk.obj\
-           dat.obj bmp.obj mid.obj pal.obj wav.obj plv.obj\
-           memory.obj pr.obj list.obj reslist.obj
-
-XML      = parse.obj search.obj resources.obj
-COMPRESS = compress.obj lzg_compress.obj lzg_uncompress.obj rle_compress.obj rle_uncompress.obj 
-CONSOLE  = main.obj filedir.obj
-
-EXEOBJ   = $(FILES) $(XML) $(COMPRESS) $(CONSOLE) $(PORTS)
-LIBOBJ   = $(FILES) $(XML) $(COMPRESS) $(PORTS)
-
-EXEFILE  = bin\pr.exe
-DLLFILE  = bin\pr.dll
+ifeq ($(TYPE),Debug)
+  RELEASE       = -g -Wall -pedantic 
+  LINKERRELEASE =
+else
+  RELEASE       = -O2 
+  LINKERRELEASE = -s
+endif
+
+ACTIONS  = .import.obj .export.obj .classify.obj
+XML      = .parse.obj .search.obj .unknown.obj .translate.obj .tree.obj
+COMPRESS = .compress.obj .lzg_compress.obj .lzg_uncompress.obj .rle_compress.obj .rle_uncompress.obj .rlec_uncompress.obj 
+LAYERS   = .dat.obj .memory.obj .list.obj .reslist.obj .pallist.obj .disk.obj .idlist.obj .autodetect.obj .stringformat.obj .resourcematch.obj .palette.obj
+FORMAT   = .bmp.obj .mid.obj .pal.obj .wav.obj .plv.obj
+CONSOLE  = .main.obj .filedir.obj
+MAIN     = .pr.obj
+
+EXEOBJ   = $(MAIN) $(XML) $(COMPRESS) $(ACTIONS) $(LAYERS) $(FORMAT) $(PORTS) $(CONSOLE)
+LIBOBJ   = $(MAIN) $(XML) $(COMPRESS) $(ACTIONS) $(LAYERS) $(FORMAT) $(PORTS)
+
+EXEFILE  = bin\pr
 XMLFILE  = bin\resources.xml
 
+ADDONS   = .python.obj
+
 #Use this to temporary remove an option
 OPTIONS       = $(INCLUDE) $(DEFINES) $(RELEASE)
-LINKEROPTIONS = $(LINKERRELEASE)
+LINKEROPTIONS = $(LINKERRELEASE) $(LIBS)
 
 #main file
 
-$(EXEFILE): $(EXEOBJ)
+$(EXEFILE): $(EXEOBJ) $(XMLFILE)
 	$(INFO) Linking files...
-	$(CC) $(EXEOBJ) -o $(EXEFILE) $(LINKEROPTIONS)
+	$(MAKEDIR) bin
+	$(CC) $(OPTIONS) -o $(EXEFILE) $(EXEOBJ)
 	$(INFO) Program successfully compiled
-	$(INFO):
+	$(INFO)
 	$(INFO) Please read readme.txt for syntax information
-	$(INFO):
+	$(INFO)
 
 #command options
 .PHONY: clean cleanxml build all lib
 
 clean:
 	$(INFO) Erasing temporary object files...
-	$(REMOVER) *.obj
-	$(REMOVER) $(EXEFILE)
+	$(REMOVER) $(EXEOBJ) $(EXEFILE) $(ADDONS)
 
 cleanxml:
 	$(INFO) Erasing xml file...
@@ -80,135 +97,173 @@ build: clean bin\pr
 
 all: $(EXEFILE)
 
-$(DLLFILE): $(LIBOBJ)
+lib: $(LIBOBJ)
 	$(MAKEDIR) bin
 	$(INFO) Making dynamic library...
-	$(CC) $(LIBOBJ) -dll ..\winbins\pr.def -o bin\pr.dll
+	$(CC) $(OPTIONS) -o bin\pr.so $(LIBOBJ) -Llibc -shared -dynamic -o $@
 	$(INFO) Library successfully compiled
-	$(INFO):
+	$(INFO)
 	$(INFO) Please read readme.coders.txt and pr.h for interfaces
-	$(INFO):
+	$(INFO)
 
 #files
 
-$(XMLFILE): resources.xml.gz
-	$(INFO) Uncompressing resources...
+$(XMLFILE): xml\resources.xml
+	$(INFO) Copying resources...
 	$(MAKEDIR) bin
-	$(GZIP) -cd resources.xml.gz >bin\resources.xml
+	$(COPY) xml\resources.xml $(XMLFILE)
 
-import.obj: lib\actions\import.c
+.import.obj: lib\actions\import.c include\autodetect.h include\bmp.h include\common.h include\dat.h include\disk.h include\idlist.h include\import.h include\memory.h include\mid.h include\pal.h include\plv.h include\unknown.h include\wav.h
 	$(INFO) Compiling import module...
-	$(CC) $(OPTIONS) -c lib\actions\import.c
+	$(CC) $(OPTIONS) -c lib\actions\import.c -o $@
 
-memory.obj: lib\layers\memory.c
-	$(INFO) Compiling memory manager...
-	$(CC) $(OPTIONS) -c lib\layers\memory.c
+.classify.obj: lib\actions\classify.c include\autodetect.h include\classify.h include\common.h include\dat.h include\disk.h include\memory.h
+	$(INFO) Compiling classification module...
+	$(CC) $(OPTIONS) -c lib\actions\classify.c -o $@
 
-export.obj: lib\actions\export.c
+.export.obj: lib\actions\export.c include\autodetect.h include\bmp.h include\common.h include\dat.h include\disk.h include\export.h include\idlist.h include\memory.h include\mid.h include\pal.h include\plv.h include\reslist.h include\unknown.h include\wav.h
 	$(INFO) Compiling export module...
-	$(CC) $(OPTIONS) -c lib\actions\export.c
+	$(CC) $(OPTIONS) -c lib\actions\export.c -o $@
+
+.autodetect.obj: lib\layers\autodetect.c include\autodetect.h
+	$(INFO) Compiling resource autodetection module...
+	$(CC) $(OPTIONS) -c lib\layers\autodetect.c -o $@
 
-compress.obj: lib\compression\main.c
-	$(INFO) Compiling main compression module...
-	$(CC) $(OPTIONS) -Focompress.obj -c lib\compression\main.c
+.idlist.obj: lib\layers\idlist.c include\disk.h include\idlist.h include\memory.h
+	$(INFO) Compiling id list layer...
+	$(CC) $(OPTIONS) -c lib\layers\idlist.c -o $@
+
+.disk.obj: lib\layers\disk.c include\common.h include\direntwin.h include\disk.h include\memory.h
+	$(INFO) Compiling disk access library...
+	$(CC) $(OPTIONS) -c lib\layers\disk.c -o $@
+
+.dat.obj: lib\layers\dat.c include\common.h include\dat.h include\disk.h include\reslist.h
+	$(INFO) Compiling DAT editing library...
+	$(CC) $(OPTIONS) -c lib\layers\dat.c -o $@
+
+.memory.obj: lib\layers\memory.c include\memory.h
+	$(INFO) Compiling memory manager...
+	$(CC) $(OPTIONS) -c lib\layers\memory.c -o $@
+
+.list.obj: lib\layers\list.c include\list.h
+	$(INFO) Compiling list implementation...
+	$(CC) $(OPTIONS) -c lib\layers\list.c -o $@
 
-lzg_compress.obj: lib\compression\lzg_compress.c
+.reslist.obj: lib\layers\reslist.c include\memory.h include\reslist.h
+	$(INFO) Compiling resource list module...
+	$(CC) $(OPTIONS) -c lib\layers\reslist.c -o $@
+
+.pallist.obj: lib\layers\pallist.c include\memory.h include\pallist.h
+	$(INFO) Compiling palette list module...
+	$(CC) $(OPTIONS) -c lib\layers\pallist.c -o $@
+
+.compress.obj: lib\compression\main.c include\compress.h include\disk.h include\memory.h
+	$(INFO) Compiling main compression library...
+	$(CC) $(OPTIONS) -c lib\compression\main.c -o $@
+
+.lzg_compress.obj: lib\compression\lzg_compress.c include\compress.h
 	$(INFO) Compiling LZG compression module...
-	$(CC) $(OPTIONS) -c lib\compression\lzg_compress.c
+	$(CC) $(OPTIONS) -c lib\compression\lzg_compress.c -o $@
 
-rle_compress.obj: lib\compression\rle_compress.c
+.rle_compress.obj: lib\compression\rle_compress.c
 	$(INFO) Compiling RLE compression module...
-	$(CC) $(OPTIONS) -c lib\compression\rle_compress.c
+	$(CC) $(OPTIONS) -c lib\compression\rle_compress.c -o $@
 
-lzg_uncompress.obj: lib\compression\lzg_uncompress.c
+.lzg_uncompress.obj: lib\compression\lzg_uncompress.c include\compress.h
 	$(INFO) Compiling LZG uncompression module...
-	$(CC) $(OPTIONS) -c lib\compression\lzg_uncompress.c
+	$(CC) $(OPTIONS) -c lib\compression\lzg_uncompress.c -o $@
 
-rle_uncompress.obj: lib\compression\rle_uncompress.c
+.rle_uncompress.obj: lib\compression\rle_uncompress.c include\compress.h
 	$(INFO) Compiling RLE uncompression module...
-	$(CC) $(OPTIONS) -c lib\compression\rle_uncompress.c
+	$(CC) $(OPTIONS) -c lib\compression\rle_uncompress.c -o $@
 
-main.obj: console\main.c
-	$(INFO) Compiling command parsing module for standard mode...
-	$(CC) $(OPTIONS) -c console\main.c
+.rlec_uncompress.obj: lib\compression\rlec_uncompress.c include\compress.h
+	$(INFO) Compiling RLEC uncompression module...
+	$(CC) $(OPTIONS) -c lib\compression\rlec_uncompress.c -o $@
 
-pr.obj: lib\pr.c
+.pr.obj: lib\pr.c include\classify.h include\common.h include\disk.h include\export.h include\idlist.h include\import.h include\memory.h include\unknown.h
 	$(INFO) Compiling main library primitives for both modes...
-	$(CC) $(OPTIONS) -c lib\pr.c
+	$(CC) $(OPTIONS) -c lib\pr.c -o $@
 	
-filedir.obj: console\filedir.c
+.main.obj: console\main.c include\common.h include\compress.h include\disk.h include\filedir.h include\getopt.h include\memory.h include\parse.h
+	$(INFO) Compiling command parsing module for standard mode...
+	$(CC) $(OPTIONS) -c console\main.c -o $@
+
+.filedir.obj: console\filedir.c include\disk.h include\memory.h include\search.h
 	$(INFO) Compiling directory and recursive file reading module for standard mode...
-	$(CC) $(OPTIONS) -c console\filedir.c
+	$(CC) $(OPTIONS) -c console\filedir.c -o $@
 
-resources.obj: lib\xml\resources.c
-	$(INFO) Compiling xml resource module...
-	$(CC) $(OPTIONS) -c lib\xml\resources.c
+.unknown.obj: lib\xml\unknown.c include\common.h include\disk.h include\unknown.h include\tree.h include\search.h
+	$(INFO) Compiling unknown.xml generating module...
+	$(CC) $(OPTIONS) -c lib\xml\unknown.c -o $@
 
-classify.obj: lib\actions\classify.c
-	$(INFO) Compiling classification module...
-	$(CC) $(OPTIONS) -c lib\actions\classify.c
+.tree.obj: lib\xml\tree.c include\common.h include\disk.h include\tree.h include\search.h
+	$(INFO) Compiling XML tree special handling routines...
+	$(CC) $(OPTIONS) -c lib\xml\tree.c -o $@
 
-parse.obj: lib\xml\parse.c
+.parse.obj: lib\xml\parse.c include\common.h include\disk.h include\memory.h include\parse.h
 	$(INFO) Compiling XML parsing module...
-	$(CC) $(OPTIONS) -c lib\xml\parse.c
+	$(CC) $(OPTIONS) -c lib\xml\parse.c -o $@
 
-search.obj: lib\xml\search.c
+.search.obj: lib\xml\search.c include\common.h include\memory.h include\parse.h include\reslist.h include\search.h
 	$(INFO) Compiling XML search features...
-	$(CC) $(OPTIONS) -c lib\xml\search.c
-
-autodetect.obj: lib\layers\autodetect.c include\autodetect.h
-	$(INFO) Compiling resource autodetection module...
-	$(CC) $(OPTIONS) -c lib\layers\autodetect.c
+	$(CC) $(OPTIONS) -c lib\xml\search.c -o $@
 
-idlist.obj: lib\layers\idlist.c include\disk.h include\idlist.h include\memory.h
-	$(INFO) Compiling id list layer...
-	$(CC) $(OPTIONS) -c lib\layers\idlist.c
+.translate.obj: lib\xml\translate.c include\translate.h
+	$(INFO) Compiling array tranlation features...
+	$(CC) $(OPTIONS) -c lib\xml\translate.c -o $@
 
-disk.obj: lib\layers\disk.c
-	$(INFO) Compiling disk access library...
-	$(CC) $(OPTIONS) -c lib\layers\disk.c
+.stringformat.obj: lib\layers\stringformat.c include\common.h
+	$(INFO) Compiling unknown string format parsing feature...
+	$(CC) $(OPTIONS) -c lib\layers\stringformat.c -o $@
 
-dat.obj: lib\layers\dat.c
-	$(INFO) Compiling DAT editing library...
-	$(CC) $(OPTIONS) -c lib\layers\dat.c
+.palette.obj: lib\layers\palette.c include\common.h
+	$(INFO) Compiling the palette object support...
+	$(CC) $(OPTIONS) -c lib\layers\palette.c -o $@
 
-list.obj: lib\layers\list.c
-	$(INFO) Compiling list implementation...
-	$(CC) $(OPTIONS) -c lib\layers\list.c
+.resourcematch.obj: lib\layers\resourcematch.c include\search.h include\memory.h include\resourcematch.h
+	$(INFO) Compiling resource list parsing feature...
+	$(CC) $(OPTIONS) -c lib\layers\resourcematch.c -o $@
 
-reslist.obj: lib\layers\reslist.c
-	$(INFO) Compiling resource list module...
-	$(CC) $(OPTIONS) -c lib\layers\reslist.c
-
-bmp.obj: lib\formats\bmp.c
-	$(INFO) Compiling bitmap files support (bmp)...
-	$(CC) $(OPTIONS) -c lib\formats\bmp.c
+.bmp.obj: lib\formats\bmp.c include\bmp.h include\common.h include\dat.h include\disk.h include\memory.h
+	$(INFO) Compiling bitmap files support \(bmp\)...
+	$(CC) $(OPTIONS) -c lib\formats\bmp.c -o $@
 
-mid.obj: lib\formats\mid.c
-	$(INFO) Compiling MIDI audio files support (mid)...
-	$(CC) $(OPTIONS) -c lib\formats\mid.c
+.mid.obj: lib\formats\mid.c include\common.h include\dat.h include\disk.h include\mid.h
+	$(INFO) Compiling MIDI audio files support \(mid\)...
+	$(CC) $(OPTIONS) -c lib\formats\mid.c -o $@
 
-plv.obj: lib\formats\plv.c
-	$(INFO) Compiling prince level files support (plv)...
-	$(CC) $(OPTIONS) -c lib\formats\plv.c
+.plv.obj: lib\formats\plv.c include\dat.h include\disk.h include\plv.h
+	$(INFO) Compiling prince level files support \(plv\)...
+	$(CC) $(OPTIONS) -c lib\formats\plv.c -o $@
 
-pal.obj: lib\formats\pal.c
-	$(INFO) Compiling JASC palette support (pal)...
-	$(CC) $(OPTIONS) -c lib\formats\pal.c
+.pal.obj: lib\formats\pal.c include\dat.h include\disk.h include\pal.h
+	$(INFO) Compiling JASC palette support \(pal\)...
+	$(CC) $(OPTIONS) -c lib\formats\pal.c -o $@
 
-wav.obj: lib\formats\wav.c
-	$(INFO) Compiling digital wave audio support (wav)...
-	$(CC) $(OPTIONS) -c lib\formats\wav.c
+.wav.obj: lib\formats\wav.c include\dat.h include\disk.h include\wav.h
+	$(INFO) Compiling digital wave audio support \(wav\)...
+	$(CC) $(OPTIONS) -c lib\formats\wav.c -o $@
 
-dirent.obj: ports\dirent.c
+.dirent.obj: ports\dirent.c include\direntwin.h
 	$(INFO) Porting the dirent structure...
-	$(CC) $(OPTIONS) -c ports\dirent.c
+	$(CC) $(OPTIONS) -c ports\dirent.c -o $@
 	
-getopt.obj: ports\getopt.c
-	$(INFO) Porting the Unix-like getopt function (first part)...
-	$(CC) $(OPTIONS) -c ports\getopt.c
-
-getopt1.obj: ports\getopt1.c
-	$(INFO) Porting the Unix-like getopt function (second part)...
-	$(CC) $(OPTIONS) -c ports\getopt1.c
+.getopt.obj: ports\getopt.c include\getopt.h
+	$(INFO) Porting the Unix-like getopt function \(first part\)...
+	$(CC) $(OPTIONS) -c ports\getopt.c -o $@
+
+.getopt1.obj: ports\getopt1.c include\getopt.h
+	$(INFO) Porting the Unix-like getopt function \(second part\)...
+	$(CC) $(OPTIONS) -c ports\getopt1.c -o $@
+
+#python
+.python.obj: addons\python\python.c include\pr.h
+	$(INFO) Building the python interfaces
+	$(CC) -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -fPIC -I\usr\include\python2.3 -c addons\python\python.c $(INCLUDE) -o $@
+	
+pylib: .python.obj $(LIBOBJ)
+	$(INFO) Building the python module
+	$(MAKEDIR) addons\python\bin
+	$(CC) -pthread -shared .python.obj $(LIBOBJ) -o addons\python\bin\pr.so -o $@