Makefile 1.28 KB
Newer Older
1
# This is not a kbuild Makefile. It is a plain Makefile so it can be copied
2

3 4 5 6 7
# If it exists includes Makefile.specific. In this Makefile, you should put
# specific Makefile code that you want to run before this. For example,
# build a particular environment.
-include Makefile.specific

8
# include parent_common.mk for buildsystem's defines
9
REPO_PARENT ?= ../..
10
-include $(REPO_PARENT)/parent_common.mk
11

12
ZIO ?= ../zio
13
ZIO_ABS ?= $(abspath $(ZIO) )
14

15 16
LIB = libfmctdc.a
LOBJ := fmctdc-lib.o
17
LOBJ += fmctdc-lib-math.o
18

19 20
GIT_VERSION := $(shell git describe --dirty --long --tags)
ZIO_GIT_VERSION := $(shell cd $(ZIO_ABS); git describe --dirty --long --tags)
21

22
CFLAGS = -Wall -Werror -ggdb -O2 -I../kernel -I$(ZIO_ABS)/include $(EXTRACFLAGS)
23 24
CFLAGS += -DGIT_VERSION="\"$(GIT_VERSION)\""
CFLAGS += -DZIO_GIT_VERSION="\"$(ZIO_GIT_VERSION)\""
25
DESTDIR ?= /usr/local
26

27
modules all: lib
28 29 30 31 32 33 34

lib: $(LIB)

%: %.c $(LIB)
	$(CC) $(CFLAGS) $*.c $(LDFLAGS) -o $@

$(LIB): $(LOBJ)
35
	$(AR) r $@ $^
36

37
clean:
38 39 40 41 42
	rm -f $(LIB) .depend *.o *~

.depend: Makefile $(wildcard *.c *.h ../*.h)
	$(CC) $(CFLAGS) -M $(LOBJ:.o=.c) -o $@

43 44 45 46 47 48 49 50
install:
	install -d $(DESTDIR)/lib
	install -d $(DESTDIR)/include/fmc-tdc

	install -m 644 -D $(LIB) $(DESTDIR)/lib
	install -m 644 -D fmctdc-lib.h $(DESTDIR)/include/fmc-tdc

modules_install:
51 52

-include .depend