diff options
author | Mattias Andrée <maandree@kth.se> | 2016-02-10 16:47:02 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-02-10 16:47:02 +0100 |
commit | 136e3443793df6c4738186920dfb2d87ac52a96b (patch) | |
tree | 814ffe88a9d51406486c082a0e1feb165650049e /Makefile | |
download | optimised-true-136e3443793df6c4738186920dfb2d87ac52a96b.tar.gz optimised-true-136e3443793df6c4738186920dfb2d87ac52a96b.tar.bz2 optimised-true-136e3443793df6c4738186920dfb2d87ac52a96b.tar.xz |
initial commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | Makefile | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..08898b5 --- /dev/null +++ b/Makefile @@ -0,0 +1,58 @@ +PREFIX = /usr/local +EXEC_PREFIX = $(PREFIX) +BINDIR = $(EXEC_PREFIX)/bin +DATADIR = $(PREFIX)/share +LICENSEDIR = $(DATADIR)/licenses + +PKGNAME = optimised-true + +LD_FLAGS = -s +AS_FLAGS = +CC_FLAGS = -nostdinc -ffreestanding +MACHINE = $(shell uname -m) + +ifneq ($(shell test -d $(MACHINE) && echo 0 || echo 1),0) +GENERIC = 1 +LD = $(CC) +endif +ifndef GENERIC +LD_FLAGS += -nodefaultlibs -nostdlib +endif + + +all: true false + +true: true.o + $(LD) $(LD_FLAGS) -o $@ $^ +false: false.o + $(LD) $(LD_FLAGS) -o $@ $^ + +ifdef GENERIC +%.o: generic/%.c + $(CC) $(CC_FLAGS) -c -o $@ $^ +endif +ifndef GENERIC +%.o: $(MACHINE)/%.s + $(AS) $(AS_FLAGS) -o $@ $^ +endif + +install: true false + mkdir -p -- "$(DESTDIR)$(BINDIR)" "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + cp true false -- "$(DESTDIR)$(BINDIR)" + chmod 755 -- "$(DESTDIR)$(BINDIR)/true" + chmod 755 -- "$(DESTDIR)$(BINDIR)/false" + cp COPYING -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + chmod 644 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" + +uninstall: + -rm -- "$(DESTDIR)$(BINDIR)/true" + -rm -- "$(DESTDIR)$(BINDIR)/false" + -rmdir -- "$(DESTDIR)$(BINDIR)" + -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" + -rmdir "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + +clean: + -rm true.o true false.o false + +.PHONY: all clean install uninstall + |