DESTDIR :=
+OPTIONAL:=
PREFIX := /usr/local
BINDIR := $(PREFIX)/bin
DATADIR := $(PREFIX)/share
MINGW = $(findstring MINGW32, $(UNAME))
CC ?= clang
-CFLAGS += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char
+CFLAGS += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char $(OPTIONAL)
ifneq ($(shell git describe --always 2>/dev/null),)
CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
endif
endif
ifeq ($(track), no)
- CFLAGS += -DNOTRACK
+ CFLAGS += -DNOTRACK
endif
OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o fs.o utf8.o correct.o
PKGDIR := gmqcc-$(MAJOR).$(MINOR).$(PATCH)-$(PKGREL)-$(CARCH)
PKG := $(PKGDIR).pkg.tar.xz
PKGINFO := $(PKGDIR)/.PKGINFO
+CFLAGS :=
-base: clean
- $(MAKE) -C $(BASEDIR) DESTDIR=distro/archlinux/this/$(PKGDIR) PREFIX=$(PREFIX) install
+
+ifneq (, $(findstring i686, $(CARCH)))
+ CFLAGS := -m32
+endif
+
+base:
+ $(MAKE) -C $(BASEDIR) clean
+ $(MAKE) -C $(BASEDIR) OPTIONAL=$(CFLAGS) DESTDIR=distro/archlinux/this/$(PKGDIR) PREFIX=$(PREFIX) install
@echo "pkgname = gmqcc" > $(PKGINFO)
@echo "pkgver = $(MAJOR).$(MINOR).$(PATCH)-$(PKGREL)" >> $(PKGINFO)
@echo "pkgdesc = An Improved Quake C Compiler" >> $(PKGINFO)
@rm -rf $(PKGDIR)
clean:
- @rm -f $(PKG)
-
+ $(MAKE) -C $(BASEDIR) clean
+ @rm -f *.pkg.tar.xz
all: base
MINOR := `sed -n -e '/GMQCC_VERSION_MINOR/{s/.* .* //;p;q;}' $(HEADER)`
PATCH := `sed -n -e '/GMQCC_VERSION_PATCH/{s/.* .* //;p;q;}' $(HEADER)`
DEBDIR := gmqcc-$(MAJOR).$(MINOR).$(PATCH)
-DEB := $(DEBDIR).deb
+CARCH := $(shell uname -m)
+DEB := $(DEBDIR)-$(CARCH).deb
+CONTROL := $(DEBDIR)/DEBIAN/control
+
+ifneq (, $(findstring i686, $(CARCH)))
+ CFLAGS := -m32
+endif
base:
+ $(MAKE) -C $(BASEDIR) clean
$(MAKE) -C $(BASEDIR) DESTDIR=distro/deb/$(DEBDIR) PREFIX=$(PREFIX) install
@install -d -m755 $(DEBDIR)/DEBIAN
- @cp control $(DEBDIR)/DEBIAN/control
+ @echo "Package: gmqcc" > $(CONTROL)
+ @echo "Version: $(MAJOR).$(MINOR).$(PATCH)" >> $(CONTROL)
+ @echo "Section: user/hidden" >> $(CONTROL)
+ @echo "Priority: optional" >> $(CONTROL)
+ @echo "Architecture: $(CARCH)" >> $(CONTROL)
+ @echo "Installed-Size: `du -ks $($(DEBDIR)/usr) | cut -f 1`" >> $(CONTROL)
+ @echo "Maintainer: Dale Weiler <killfieldengine@gmail.com>" >> $(CONTROL)
+ @echo "Description: An improved Quake C Compiler" >> $(CONTROL)
+ @echo " For an enduring period of time the options for a decent compiler for the Quake C programming language" >> $(CONTROL)
+ @echo " were confined to a specific compiler known as QCC. Attempts were made to extend and improve upon the" >> $(CONTROL)
+ @echo " design of QCC, but many foreseen the consequences of building on a broken foundation. The solution" >> $(CONTROL)
+ @echo " was obvious, a new compiler; one born from the NIH realm of sarcastic wit. We welcome you. You won't" >> $(CONTROL)
+ @echo " find a better Quake C compiler." >> $(CONTROL)
@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
@rm -rf debian-binary control.tar.gz data.tar.gz $(DEBDIR)
-clean:
- @rm -f $(DEB)
+clean:
+ $(MAKE) -C $(BASEDIR) clean
+ @rm -f *.deb
all: base
+++ /dev/null
-Package: gmqcc
-Version: 0.3.0
-Section: user/hidden
-Priority: optional
-Architecture: i386
-Installed-Size: `du -ks usr|cut -f 1`
-Maintainer: Dale Weiler <killfieldengine@gmail.com>
-Description: An improved Quake C Compiler
- For an enduring period of time the options for a decent compiler for the Quake C programming language
- were confined to a specific compiler known as QCC. Attempts were made to extend and improve upon the
- design of QCC, but many foreseen the consequences of building on a broken foundation. The solution
- was obvious, a new compiler; one born from the NIH realm of sarcastic wit. We welcome you. You won't
- find a better Quake C compiler.