b7e0247369c798f79443432c95ca677898e837b9
[goodguy/cinelerra.git] / Makefile
1 TARGETS = libprofile.so prof smap
2 BITS=64
3 #CFLAGS += -O
4 CFLAGS += -g -Wall
5 BIN_PATH ?= /usr/bin
6 LIB_PATH ?= $(dir $(lastword $(wildcard /lib*/ld-*.so /lib*/*-linux-gnu/ld-*.so)))
7 $(if $(LIB_PATH),,$(error cant find ld-.so))
8 CFLAGS += -DLIB='"$(LIB_PATH)"'
9 ASM_PATH ?= $(dir $(lastword $(wildcard /usr/include/asm/signal.h /usr/include/x86_64-linux-gnu/asm/signal.h)))
10
11 .PHONY: all
12 all:    $(TARGETS)
13
14 .PHONY: install
15 install:
16         cp -a libprofile.so $(DESTDIR)$(LIB_PATH)/.
17         cp -a prof smap $(DESTDIR)$(BIN_PATH)/.
18
19 .PHONY: uninstall
20 uninstall:
21         rm -f $(DESTDIR)$(LIB_PATH)/libprofile.so
22         rm -f $(DESTDIR)$(BIN_PATH)/prof
23         rm -f $(DESTDIR)$(BIN_PATH)/smap
24
25 libprofile.so:  profile.c
26         $(CC) $(CFLAGS) -fPIC -shared -o $@ $<
27
28 prof:   prof.c sys.h
29         $(CC) $(CFLAGS) -o $@ $<
30
31 smap:   smap.C
32         $(CXX) $(CFLAGS) -o $@ $< \
33          -Wall -I/usr/include/libiberty -llzma -liberty
34
35 tst:    tst.c
36
37 sys.h:  $(ASM_PATH/signal.h $(ASM_PATH)/unistd.h
38         echo "char *sysreq_name[] = {" > sys.h
39         ./mksyscallent < $(ASM_PATH)/unistd_$(BITS).h >> sys.h
40         echo "};" >> sys.h
41         echo "char *signal_name[] = {" >> sys.h
42         ./mksignalent < $(ASM_PATH)/signal.h >> sys.h
43         echo "};" >> sys.h
44
45 .PHONY: clean
46 clean:
47         rm -f $(TARGETS) tst sys.h