MAKEFILE

libfaketime

Makefile source

Project updated · 7 April 2006

Download raw Makefile ↓


CC=gcc
CFLAGS=-Wall -g
LIBFAKETIME=libfaketime.so

%.so: %.c
        $(CC) -fPIC $(CFLAGS) -c -o $@ $<

all: timetest $(LIBFAKETIME)

timetest: timetest.o
        $(CC) $(CFLAGS) -o $@ $<

ld-so.h: dummy.c
        $(CC) -o tmp-dummy dummy.c
        objcopy --only-section .interp --output-target binary tmp-dummy tmp-dummy.interp
        awk 'BEGIN{printf("#ifdef LD_SO\n#undef LD_SO\n#endif\n\n");} NR==1{gsub (/\000/, "", $$1); printf("#define LD_SO \"%s\"\n", $$1);}' tmp-dummy.interp > ld-so.h
        rm -f tmp-dummy*

$(LIBFAKETIME): faketime.so
        $(CC) -shared -o $@ -Wl,-soname,$(LIBFAKETIME) $< -ldl -e __faketime_main

faketime.so: faketime.c ld-so.h

test: all
        @echo ==== Without preloaded library...
        ./timetest
        @echo
        @echo ==== Set the date to yesterday...
        FAKE_TIME_OFFSET=-86400 LD_PRELOAD=./libfaketime.so ./timetest
        @echo
        @echo ==== Set the date to 2000/01/01 12:13:14...
        FAKE_TIME_START=946725194 LD_PRELOAD=./libfaketime.so ./timetest

clean:
        -rm -f *.o *.so core timetest $(LIBFAKETIME) ld-so.h tmp-dummy*
Makefile sourceUTF-8 · LOGIX.CZ

Find in Logix

Search page titles and descriptions. Esc closes.

A few handy keys

A little Borland, a little early desktop, a corner of the web to call home.

Pick a directory from the menu or tree. Use Find when you know what you’re after.

Tab / Shift+Tab
Move between controls
↑ / ↓ in menus
Choose an entry
← / → in menus
Switch directories
/
Find a page
Esc
Close menu or dialog
F1
Open this help

Prefer a different atmosphere? View has blue, grey, and green palettes.

No commands to learn. Just follow your curiosity.