Merge remote-tracking branch 'origin/master' into cooking

This commit is contained in:
Wolfgang Bumiller 2014-04-07 14:23:35 +02:00
commit e8133893a0
14 changed files with 131 additions and 45 deletions

View file

@ -2,7 +2,7 @@ include include.mk
UNAME ?= $(shell uname)
CYGWIN = $(findstring CYGWIN, $(UNAME))
MINGW = $(findstring MINGW32, $(UNAME))
MINGW = $(findstring MINGW, $(UNAME))
CFLAGS += -Wall -Wextra -Werror -Wstrict-aliasing -Wno-attributes
#turn on tons of warnings if clang is present
@ -40,7 +40,8 @@ endif
# do this last otherwise there is whitespace in the command output and
# it makes my OCD act up
CFLAGS += $(OPTIONAL)
CFLAGS += $(OPTIONAL_CFLAGS)
LDFLAGS += $(OPTIONAL_LDFLAGS)
#we have duplicate object files when dealing with creating a simple list
#for dependinces. To combat this we use some clever recrusive-make to

View file

@ -9,18 +9,57 @@ endif
.NOTPARALLEL: base
.NOTPARALLEL: upload
HEADER=\e[5;32;40m
RESET=\e[0;37;40m
INFO=\e[5;33;40m
base:
$(MAKE) -C deb/
$(MAKE) -C deb/ CARCH=i686
$(MAKE) -C archlinux/this/
$(MAKE) -C archlinux/this/ CARCH=i686
$(MAKE) -C win32/
$(MAKE) -C slackware/this/
$(MAKE) -C slackware/this/ CARCH=i686
@mv deb/*.deb ./
@mv archlinux/this/*pkg.tar.xz ./
@mv win32/*.zip ./
@mv slackware/this/*.txz ./
@echo -e "\n$(HEADER)Building Debian packages ...$(RESET)"
@echo -e " $(INFO)=> building 64-bit package$(RESET)"
@$(MAKE) -C deb/ >/dev/null
@echo -e " $(INFO)=> building 32-bit package$(RESET)"
@$(MAKE) -C deb/ CARCH=i686 OPTIONAL_CFLAGS=-m32 OPTIONAL_LDFLAGS=-m32 >/dev/null
@echo -e "\n$(HEADER)Building ArchLinux packages ...$(RESET)"
@echo -e " $(INFO)=> building 64-bit package$(RESET)"
@$(MAKE) -C archlinux/this/ >/dev/null
@echo -e " $(INFO)=> building 32-bit package$(RESET)"
@$(MAKE) -C archlinux/this/ CARCH=i686 OPTIONAL_CFLAGS=-m32 OPTIONAL_LDFLAGS=-m32 >/dev/null
@echo -e "\n$(HEADER)Building ArchBSD packages ...$(RESET)"
@echo -e " $(INFO)=> building 64-bit package$(RESET)"
@$(MAKE) -C archbsd/this/ >/dev/null
@echo -e " $(INFO)=> building 32-bit package$(RESET)"
@$(MAKE) -C archbsd/this/ CARCH=i686 OPTIONAL_CFLAGS=-m32 OPTIONAL_LDFLAGS=-m32 >/dev/null
@echo -e "\n$(HEADER)Building Slackware packages ...$(RESET)"
@echo -e " $(INFO)=> building 64-bit package$(RESET)"
@$(MAKE) -C slackware/this/ >/dev/null
@echo -e " $(INFO)=> building 32-bit package$(RESET)"
@$(MAKE) -C slackware/this/ CARCH=i686 OPTIONAL_CFLAGS=-m32 OPTIONAL_LDFLAGS=-m32 >/dev/null
@echo -e "\n$(HEADER)Building Fedora packages ...$(RESET)"
@echo -e " $(INFO)=> building 64-bit package$(RESET)"
@$(MAKE) -C fedora/this/ >/dev/null
@echo -e "\n\$(HEADER)Building Windows packages ...$(RESET)"
@echo -e " $(INFO)=> building 64-bit package$(RESET)"
@$(MAKE) -C win64/ >/dev/null
@echo -e " $(INFO)=> building 32-bit package$(RESET)"
@$(MAKE) -C win32/ >/dev/null
@rm -rf pkgs/
@mkdir pkgs/
@mv deb/*.deb ./pkgs/
@mv archlinux/this/*pkg.tar.xz ./pkgs/
@mv archbsd/this/*pkg.tar.xz ./pkgs/
@mv win32/*.zip ./pkgs/
@mv win64/*.zip ./pkgs/
@mv slackware/this/*.txz ./pkgs/
@mv fedora/this/*.rpm ./pkgs/
@echo -e "\n\n$(HEADER)Completed:$(RESET)"
@find ./pkgs/ -type f -regex ".*/.*\.\(xz\|deb\|zip\|txz\|rpm\)" -exec echo -e " $(INFO)=>$(RESET) {}" \;
upload:
@echo "APPKEY:76vh3q42hnvmzm3" > dropbox_config
@ -31,7 +70,7 @@ upload:
@wget -q "http://raw.github.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh"
@chmod +x dropbox_uploader.sh
@sed -i -e "s/~\/.dropbox_uploader/.\/dropbox_config/g" $$(basename $(DROPBOX))
@find . -type f -regex ".*/.*\.\(xz\|deb\|zip\|txz\)" -exec ./$$(basename $(DROPBOX)) upload {} \;
@find ./pkgs -type f -regex ".*/.*\.\(xz\|deb\|zip\|txz\|rpm\)" -exec ./$$(basename $(DROPBOX)) upload {} \;
@rm dropbox_config dropbox_uploader.sh
website:
@ -47,11 +86,7 @@ website:
@git stash apply
clean:
@rm -f *.deb
@rm -f *.pkg.tar.xz
@rm -f *.zip
@rm -f *.gen
@rm -rf pkgs/
@rm -f *.html
@rm -f *.txz
all: base upload

View file

@ -1,4 +1,5 @@
all:
$(MAKE) -f ../../archlinux/this/Makefile \
LIBC_DEPEND=libc \
DESTDIR=distro/archbsd/this
DESTDIR=distro/archbsd/this \
SUFFIX=archbsd

View file

@ -5,8 +5,9 @@ MAJOR := $(shell sed -n -e '/GMQCC_VERSION_MAJOR/{s/.* .* //;p;q;}' $(HEADER))
MINOR := $(shell sed -n -e '/GMQCC_VERSION_MINOR/{s/.* .* //;p;q;}' $(HEADER))
PATCH := $(shell sed -n -e '/GMQCC_VERSION_PATCH/{s/.* .* //;p;q;}' $(HEADER))
PKGREL := 1
SUFFIX ?= archlinux
CARCH := $(shell uname -m)
PKGDIR := gmqcc-$(MAJOR).$(MINOR).$(PATCH)-$(PKGREL)-$(CARCH)
PKGDIR := gmqcc-$(MAJOR).$(MINOR).$(PATCH)-$(PKGREL)-$(CARCH)-$(SUFFIX)
TARCOMP := -J
PKG := $(PKGDIR).pkg.tar.xz
PKGINFO := $(PKGDIR)/.PKGINFO
@ -15,11 +16,6 @@ CFLAGS :=
LIBC_DEPEND := glibc
ifneq (, $(findstring i686, $(CARCH)))
CFLAGS += -m32
LDFLAGS += -m32
endif
base:
$(MAKE) -C $(BASEDIR) clean
CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
@ -45,8 +41,8 @@ base:
@bsdtar -C $(PKGDIR) -czf $(PKGDIR)/.MTREE \
--format=mtree \
--options='!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link' \
.PKGINFO usr/
@bsdtar $(TARCOMP) -cvf $(PKG) -C $(PKGDIR)/ .PKGINFO .MTREE usr/
.PKGINFO usr/ 2>&1 >/dev/null
@bsdtar $(TARCOMP) -cvf $(PKG) -C $(PKGDIR)/ .PKGINFO .MTREE usr/ 2>&1 >/dev/null
@rm -rf $(PKGDIR)
clean:

View file

@ -35,7 +35,7 @@ base:
@tar czf data.tar.gz -C $(DEBDIR)/ . --exclude=DEBIAN
@tar czf control.tar.gz -C $(DEBDIR)/DEBIAN/ .
@echo 2.0 > debian-binary
@ar r $(DEB) debian-binary control.tar.gz data.tar.gz
@ar r $(DEB) debian-binary control.tar.gz data.tar.gz 2>&1 >/dev/null
@rm -rf debian-binary control.tar.gz data.tar.gz $(DEBDIR)
clean:

View file

@ -1,12 +1,10 @@
Name: gmqcc
Version: 0.3.5
Version: 0.3.6
Release: 2%{?dist}
Summary: Improved Quake C Compiler
License: MIT
URL: http://graphitemaster.github.io/gmqcc/
Source0: https://github.com/graphitemaster/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# fix build on big endian arches - stdlib.h required for exit()
Patch0: %{name}-0.3.5-stdlib.patch
# tests fail on big endians
ExclusiveArch: %{ix86} x86_64 %{arm}
@ -33,14 +31,13 @@ directories, or whole PAKs, as well as the opposite (creation of PAK files).
%prep
%setup -q
%patch0 -p1
echo '#!/bin/sh' > ./configure
chmod +x ./configure
# and for all for all of those switches they increase the runtime of the compile
# making compiles of code slower
# we don't need compiel time buffer protection, we test with clangs address
# we don't need compile time buffer protection, we test with clang's address
# sanatizer and valgrind before releases
%global optflags %(echo %{optflags} | sed 's/-D_FORTIFY_SOURCE=2 //')
# there is no exceptions in C
@ -49,9 +46,9 @@ chmod +x ./configure
%global optflags %(echo %{optflags} | sed 's/-fstack-protector-strong //')
# buffer overflow protection is unrequired since most (if not all) allocations
# happen dynamically and we have our own memory allocator which checks this
# (with valgrind integration), also clangs address santatizer cathes it as
# (with valgrind integration), also clang's address santatizer cathes it as
# for grecord-gcc-switches, that just adds pointless information to the binary
# increasing it size
# increasing its size
%global optflags %(echo %{optflags} | sed 's/--param=ssp-buffer-size=4 //')
%build

View file

@ -0,0 +1,21 @@
BASEDIR := $(CURDIR)/../../..
HEADER := $(BASEDIR)/gmqcc.h
MAJOR := `sed -n -e '/GMQCC_VERSION_MAJOR/{s/.* .* //;p;q;}' $(HEADER)`
MINOR := `sed -n -e '/GMQCC_VERSION_MINOR/{s/.* .* //;p;q;}' $(HEADER)`
PATCH := `sed -n -e '/GMQCC_VERSION_PATCH/{s/.* .* //;p;q;}' $(HEADER)`
NAME := gmqcc-$(MAJOR).$(MINOR).$(PATCH)
TARFILE := $(NAME).tar.gz
all:
@mkdir -p ~/rpmbuild/SPECS
@mkdir -p ~/rpmbuild/SOURCES
@cp ../spec/gmqcc.spec ~/rpmbuild/SPECS
@mkdir -p /tmp/$(NAME)
@cp -R $(BASEDIR) /tmp/$(NAME)/
@cd /tmp && tar -zcf ~/rpmbuild/SOURCES/$(TARFILE) $(NAME)/
@rm -rf /tmp/$(NAME)
@rpmbuild -ba ../spec/gmqcc.spec 2>&1 >/dev/null
@mv ~/rpmbuild/RPMS/x86_64/gmqcc*.rpm . 2>/dev/null; true
@mv ~/rpmbuild/RPMS/x86_64/qcvm*.rpm . 2>/dev/null; true
@mv ~/rpmbuild/RPMS/x86_64/gmqpak*.rpm . 2>/dev/null; true

View file

@ -6,8 +6,8 @@ PATCH := `sed -n -e '/GMQCC_VERSION_PATCH/{s/.* .* //;p;q;}' $(HEADER)`
BINDIR := gmqcc-$(MAJOR).$(MINOR).$(PATCH)
base:
$(MAKE) CC=i486-mingw32-gcc UNAME=MINGW32 -C $(BASEDIR) clean
$(MAKE) CC=i486-mingw32-gcc UNAME=MINGW32 -C $(BASEDIR) DESTDIR=distro/win32/$(BINDIR) PREFIX=/ strip install
$(MAKE) CC=i686-w64-mingw32-gcc UNAME=MINGW -C $(BASEDIR) clean
$(MAKE) CC=i686-w64-mingw32-gcc UNAME=MINGW -C $(BASEDIR) DESTDIR=distro/win32/$(BINDIR) PREFIX=/ strip install
@mkdir -p $(BINDIR)/doc
@groff -mandoc $(BINDIR)/man1/gmqpak.1 | ps2pdf - $(BINDIR)/doc/gmqpak.pdf
@groff -mandoc $(BINDIR)/man1/qcvm.1 | ps2pdf - $(BINDIR)/doc/qcvm.pdf

22
distro/win64/Makefile Normal file
View file

@ -0,0 +1,22 @@
BASEDIR := ../..
HEADER := $(BASEDIR)/gmqcc.h
MAJOR := `sed -n -e '/GMQCC_VERSION_MAJOR/{s/.* .* //;p;q;}' $(HEADER)`
MINOR := `sed -n -e '/GMQCC_VERSION_MINOR/{s/.* .* //;p;q;}' $(HEADER)`
PATCH := `sed -n -e '/GMQCC_VERSION_PATCH/{s/.* .* //;p;q;}' $(HEADER)`
BINDIR := gmqcc-$(MAJOR).$(MINOR).$(PATCH)
base:
$(MAKE) CC=x86_64-w64-mingw32-gcc UNAME=MINGW -C $(BASEDIR) clean
$(MAKE) CC=x86_64-w64-mingw32-gcc UNAME=MINGW -C $(BASEDIR) DESTDIR=distro/win64/$(BINDIR) PREFIX=/ strip install
@mkdir -p $(BINDIR)/doc
@groff -mandoc $(BINDIR)/man1/gmqpak.1 | ps2pdf - $(BINDIR)/doc/gmqpak.pdf
@groff -mandoc $(BINDIR)/man1/qcvm.1 | ps2pdf - $(BINDIR)/doc/qcvm.pdf
@groff -mandoc $(BINDIR)/man1/gmqcc.1 | ps2pdf - $(BINDIR)/doc/gmqcc.pdf
@rm -rf $(BINDIR)/man1/
@zip -r $(BINDIR)-win64.zip $(BINDIR)
@rm -rf $(BINDIR)
clean:
$(MAKE) -C $(BASEDIR) clean
@rm -f *.zip
all: base

12
ftepp.c
View file

@ -763,6 +763,7 @@ static bool ftepp_macro_expand(ftepp_t *ftepp, ppmacro *macro, macroparam *param
lex_file *inlex;
bool old_inmacro;
bool strip = false;
int nextok;
@ -827,6 +828,7 @@ static bool ftepp_macro_expand(ftepp_t *ftepp, ppmacro *macro, macroparam *param
if (nextok == '#') {
/* raw concatenation */
++o;
strip = true;
break;
}
if ( (nextok == TOKEN_IDENT ||
@ -835,6 +837,7 @@ static bool ftepp_macro_expand(ftepp_t *ftepp, ppmacro *macro, macroparam *param
macro_params_find(macro, macro->output[o+1]->value, &pi))
{
++o;
ftepp_stringify(ftepp, &params[pi]);
break;
}
@ -845,7 +848,14 @@ static bool ftepp_macro_expand(ftepp_t *ftepp, ppmacro *macro, macroparam *param
ftepp_out(ftepp, "\n", false);
break;
default:
ftepp_out(ftepp, out->value, false);
buffer = out->value;
if (vec_size(macro->output) > o + 1 && macro->output[o+1]->token == '#')
buffer++;
if (strip) {
while (util_isspace(*buffer)) buffer++;
strip = false;
}
ftepp_out(ftepp, buffer, false);
break;
}
}

View file

@ -1,6 +1,5 @@
# default directories and paths
DESTDIR :=
OPTIONAL:=
PREFIX := /usr/local
BINDIR := $(PREFIX)/bin
DATADIR := $(PREFIX)/share
@ -16,6 +15,10 @@ LIBS += -lm
#common objects
COMMON = ansi.o util.o hash.o stat.o fs.o opts.o conout.o
#optional flags
OPTIONAL_CFLAGS :=
OPTIONAL_LDFLAGS :=
#objects
OBJ_C = $(COMMON) main.o lexer.o parser.o code.o ast.o ir.o ftepp.o utf8.o correct.o fold.o intrin.o
OBJ_P = $(COMMON) pak.o

View file

@ -26,7 +26,7 @@
# define ALPHA(SEL) ALPHA_##SEL
# define ABC ALPHA(a)##ALPHA(b)##ALPHA(c)
# define ABC ALPHA(a)ALPHA(b)ALPHA(c)
void() main = {
if (ABC == "abc")

View file

@ -8,6 +8,6 @@ REDIR(CAT(hello, world), CAT(world, hello))
SCONS(hello, world)
#define FOO(X) X##X
#define BAR(X) FOO(X)##FOO(X)
#define BAR(X) FOO(X)FOO(X)
REDIR(BAR(hello), BAR(world))
REDIR(BAR(hello),BAR(world))