fixed compatibility with gcc 3.3 and improved makefiles

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3570 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-06-19 12:42:41 +00:00
parent bbd00dc276
commit 9b061b5fc9
3 changed files with 107 additions and 99 deletions

View file

@ -23,18 +23,21 @@ CXXFLAGS = -Wall -O3
CPPFLAGS = $(DEFINES)
LDFLAGS = -s -Wl,-Map,$(subst .exe,.map,$@)
all : makensis
all : exehead makensis
exehead :
$(MAKE) -C exehead
cs = zlib bzip2 lzma
rs = bitmap1.h icon.h unicon.h
deps = $(foreach c,$(cs),exehead/Release-$(c)/exehead_$(c).h) $(foreach r,$(rs),exehead/Release-zlib/$(r))
exehead : $(deps)
$(deps) :
$(MAKE) -C exehead $(foreach d,$^,$(subst exehead/,,$(d)))
$(deps) : exehead
makensis : ../makensis.exe
../makensis.exe : $(SRCS) $(OBJS) $(deps)
exedata.o : $(deps)
../makensis.exe : $(SRCS) $(OBJS)
$(CC) -Wall $(LDFLAGS) -o ../makensis.exe $(OBJS) $(LIBS)
VPATH=zlib:bzip2:7zip:7zip/Common:7zip/7zip:7zip/7zip/Compress/LZ:7zip/7zip/Compress/LZMA:7zip/7zip/Common:7zip/7zip/Compress/RangeCoder

View file

@ -1,14 +1,14 @@
# -- Objects and source files --
DEPENDS = ../Platform.h config.h
ZLIB_SRCS = bgbg.c exec.c fileform.c main.c ui.c util.c ../crc32.c resource.rc ../zlib/infblock.c
ZLIB_OBJS = Release-zlib/bgbg.o Release-zlib/exec.o Release-zlib/fileform.o Release-zlib/main.o Release-zlib/ui.o Release-zlib/util.o Release-zlib/crc32.o Release-zlib/resource.res Release-zlib/infblock.o
ZLIB_SRCS = bgbg.c exec.c fileform.c Main.c Ui.c util.c ../crc32.c resource.rc ../zlib/INFBLOCK.C
ZLIB_OBJS = Release-zlib/bgbg.o Release-zlib/exec.o Release-zlib/fileform.o Release-zlib/Main.o Release-zlib/Ui.o Release-zlib/util.o Release-zlib/crc32.o Release-zlib/resource.res Release-zlib/INFBLOCK.o
BZIP2_SRCS = bgbg.c exec.c fileform.c main.c ui.c util.c ../crc32.c resource.rc ../bzip2/bzlib.c ../bzip2/decompress.c ../bzip2/huffman.c
BZIP2_OBJS = Release-bzip2/bgbg.o Release-bzip2/exec.o Release-bzip2/fileform.o Release-bzip2/main.o Release-bzip2/ui.o Release-bzip2/util.o Release-bzip2/crc32.o Release-bzip2/resource.res Release-bzip2/bzlib.o Release-bzip2/decompress.o Release-bzip2/huffman.o
BZIP2_SRCS = bgbg.c exec.c fileform.c Main.c Ui.c util.c ../crc32.c resource.rc ../bzip2/bzlib.c ../bzip2/decompress.c ../bzip2/huffman.c
BZIP2_OBJS = Release-bzip2/bgbg.o Release-bzip2/exec.o Release-bzip2/fileform.o Release-bzip2/Main.o Release-bzip2/Ui.o Release-bzip2/util.o Release-bzip2/crc32.o Release-bzip2/resource.res Release-bzip2/bzlib.o Release-bzip2/decompress.o Release-bzip2/huffman.o
LZMA_SRCS = bgbg.c exec.c fileform.c main.c ui.c util.c ../crc32.c resource.rc ../7zip/LZMADecode.c
LZMA_OBJS = Release-lzma/bgbg.o Release-lzma/exec.o Release-lzma/fileform.o Release-lzma/main.o Release-lzma/ui.o Release-lzma/util.o Release-lzma/crc32.o Release-lzma/resource.res Release-lzma/LZMADecode.o
LZMA_SRCS = bgbg.c exec.c fileform.c Main.c Ui.c util.c ../crc32.c resource.rc ../7zip/LZMADecode.c
LZMA_OBJS = Release-lzma/bgbg.o Release-lzma/exec.o Release-lzma/fileform.o Release-lzma/Main.o Release-lzma/Ui.o Release-lzma/util.o Release-lzma/crc32.o Release-lzma/resource.res Release-lzma/LZMADecode.o
SRCS = $(ZLIB_SRCS) $(BZIP2_SRCS) $(LZMA_SRCS)
@ -28,8 +28,9 @@ LDFLAGS = -s -mwindows -nostdlib -nostartfiles --enable-stdcall-fixup -Wl,-Bdyna
RCFLAGS = --input-format rc --output-format coff
vpath %.c .:..:../zlib:../bzip2:../7zip
vpath %.C ../zlib
%c : config.h fileform.h
%.c : config.h fileform.h
all : exehead_zlib exehead_bzip2 exehead_lzma exehead_resources
@ -57,6 +58,9 @@ Release-zlib/exehead_zlib.h : Release-zlib/exehead_zlib.exe
Release-zlib/%.o : %.c
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
Release-zlib/%.o : %.C
$(CC) -x c -c $(CPPFLAGS) $(CFLAGS) $< -o $@
Release-zlib/resource.res : resource.rc resource.h config.h
$(RC) $(RCFLAGS) -o $@ -i $<
@ -116,7 +120,7 @@ Release-bzip2/ = -DNSIS_COMPRESS_USE_BZIP2
Release-lzma/ = -DNSIS_COMPRESS_USE_LZMA
getdefine = $($(dir $@))
CFLAGS =: $(CFLAGS) $(getdefine)
CFLAGS += $(getdefine)
clean ::
$(RM) -f sections_script

View file

@ -489,96 +489,97 @@ char * NSISCALL GetNSISString(char *outbuf, int strtab)
fldrs[2] = in[1]; // all users
fldrs[3] = in[1] | CSIDL_FLAG_CREATE;
in += 2;
if (nVarIdx == NS_SHELL_CODE)
{
// NOTE 1: the code CSIDL_PRINTERS, is used for QUICKLAUNCH
// NOTE 2: the code CSIDL_BITBUCKET is used for COMMONFILES
// NOTE 3: the code CSIDL_CONTROLS is used for PROGRAMFILES
LPITEMIDLIST idl;
char *append = 0;
int x = 0;
*out = 0;
if (fldrs[2] == CSIDL_PRINTERS) // QUICKLAUNCH
{
append = "\\Microsoft\\Internet Explorer\\Quick Launch";
x = 2;
}
if (fldrs[0] == CSIDL_PROGRAM_FILES_COMMON)
{
myRegGetStr(HKEY_LOCAL_MACHINE, SYSREGKEY, "CommonFilesDir", out);
}
if (fldrs[0] == CSIDL_PROGRAM_FILES)
{
myRegGetStr(HKEY_LOCAL_MACHINE, SYSREGKEY, "ProgramFilesDir", out);
if (!*out)
mystrcpy(out, "C:\\Program Files");
}
if (fldrs[0] == CSIDL_SYSTEM)
{
GetSystemDirectory(out, NSIS_MAX_STRLEN);
}
if (fldrs[0] == CSIDL_WINDOWS)
{
GetWindowsDirectory(out, NSIS_MAX_STRLEN);
}
if (!*out)
{
x = 4;
if (!g_exec_flags.all_user_var)
x = 2;
}
while (x--)
{
if (!SHGetSpecialFolderLocation(g_hwnd, fldrs[x], &idl))
{
BOOL res = SHGetPathFromIDList(idl, out);
FreePIDL(idl);
if (res)
{
break;
}
}
else
*out=0;
}
if (*out && append)
{
lstrcat(out, append);
}
validate_filename(out);
out += mystrlen(out);
}
else if (nVarIdx == NS_VAR_CODE)
{
if (nData == 27) // HWNDPARENT
myitoa(out, (unsigned int) g_hwnd);
else
mystrcpy(out, g_usrvars[nData]);
// validate the directory name
if ((unsigned int)(nData - 21) < 6) {
// validate paths for $INSTDIR, $OUTDIR, $EXEDIR, $LANGUAGE, $TEMP and $PLUGINSDIR
// $LANGUAGE is just a number anyway...
validate_filename(out);
}
out += mystrlen(out);
} // == VAR_CODES_START
else if (nVarIdx == NS_LANG_CODE)
{
GetNSISString(out, -nData-1);
out += mystrlen(out);
}
}
if (nVarIdx == NS_SKIP_CODE)
else if (nVarIdx == NS_SKIP_CODE)
{
*out++ = *in++;
}
else if (nVarIdx == NS_SHELL_CODE)
{
// NOTE 1: the code CSIDL_PRINTERS, is used for QUICKLAUNCH
// NOTE 2: the code CSIDL_BITBUCKET is used for COMMONFILES
// NOTE 3: the code CSIDL_CONTROLS is used for PROGRAMFILES
LPITEMIDLIST idl;
char *append = 0;
int x = 0;
*out = 0;
if (fldrs[2] == CSIDL_PRINTERS) // QUICKLAUNCH
{
append = "\\Microsoft\\Internet Explorer\\Quick Launch";
x = 2;
}
if (fldrs[0] == CSIDL_PROGRAM_FILES_COMMON)
{
myRegGetStr(HKEY_LOCAL_MACHINE, SYSREGKEY, "CommonFilesDir", out);
}
if (fldrs[0] == CSIDL_PROGRAM_FILES)
{
myRegGetStr(HKEY_LOCAL_MACHINE, SYSREGKEY, "ProgramFilesDir", out);
if (!*out)
mystrcpy(out, "C:\\Program Files");
}
if (fldrs[0] == CSIDL_SYSTEM)
{
GetSystemDirectory(out, NSIS_MAX_STRLEN);
}
if (fldrs[0] == CSIDL_WINDOWS)
{
GetWindowsDirectory(out, NSIS_MAX_STRLEN);
}
if (!*out)
{
x = 4;
if (!g_exec_flags.all_user_var)
x = 2;
}
while (x--)
{
if (!SHGetSpecialFolderLocation(g_hwnd, fldrs[x], &idl))
{
BOOL res = SHGetPathFromIDList(idl, out);
FreePIDL(idl);
if (res)
{
break;
}
}
else
*out=0;
}
if (*out && append)
{
lstrcat(out, append);
}
validate_filename(out);
out += mystrlen(out);
}
else if (nVarIdx == NS_VAR_CODE)
{
if (nData == 27) // HWNDPARENT
myitoa(out, (unsigned int) g_hwnd);
else
mystrcpy(out, g_usrvars[nData]);
// validate the directory name
if ((unsigned int)(nData - 21) < 6) {
// validate paths for $INSTDIR, $OUTDIR, $EXEDIR, $LANGUAGE, $TEMP and $PLUGINSDIR
// $LANGUAGE is just a number anyway...
validate_filename(out);
}
out += mystrlen(out);
} // == VAR_CODES_START
else if (nVarIdx == NS_LANG_CODE)
{
GetNSISString(out, -nData-1);
out += mystrlen(out);
}
else // Normal char
{
*out++ = nVarIdx;