]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - k3conf/k3conf.git/blob - Makefile
tisci: Add support for handling devices
[k3conf/k3conf.git] / Makefile
1 #/*
2 # * Makefile for k3conf
3 # *
4 # * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
5 # *     Lokesh Vutla <lokeshvutla@ti.com>
6 # *
7 # *  Redistribution and use in source and binary forms, with or without
8 # *  modification, are permitted provided that the following conditions
9 # *  are met:
10 # *
11 # *    Redistributions of source code must retain the above copyright
12 # *    notice, this list of conditions and the following disclaimer.
13 # *
14 # *    Redistributions in binary form must reproduce the above copyright
15 # *    notice, this list of conditions and the following disclaimer in the
16 # *    documentation and/or other materials provided with the
17 # *    distribution.
18 # *
19 # *    Neither the name of Texas Instruments Incorporated nor the names of
20 # *    its contributors may be used to endorse or promote products derived
21 # *    from this software without specific prior written permission.
22 # *
23 # *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 # *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 # *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 # *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 # *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 # *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 # *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 # *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 # *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 # *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 # *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 # */
36 VERSION_MAJOR=0
37 VERSION_MINOR=0
39 CROSS_COMPILE ?=aarch64-linux-gnu-
40 CC = $(CROSS_COMPILE)gcc
42 DEF_INC := $(shell $(CROSS_COMPILE)gcc  -print-file-name=include)
44 DEF_INC_PATH = -I. -Iinclude
46 STATIC_BUILD ?= -static
48 MYCFLAGS+=$(CFLAGS) -c -Wall -Wextra -Wno-missing-field-initializers \
49                 -I$(DEF_INC) $(DEF_INC_PATH) $(STATIC_BUILD)
51 ifdef DEBUG
52 MYCFLAGS+=-g3 -fno-inline -O0 -DDEBUG
53 else
54 MYCFLAGS+=-Os
55 endif
57 DESTDIR ?= target
59 COMMONSOURCES=\
60                 common/k3conf.c \
61                 common/help.c \
62                 common/mmio.c \
63                 common/socinfo.c \
64                 common/sec_proxy.c \
65                 common/tisci/tisci_core.c \
66                 common/tisci/tisci_device.c
68 COMMONOBJECTS=  $(COMMONSOURCES:.c=.o)
70 ALLSOURCES=     $(COMMONSOURCES)
72 ALLOBJECTS=     $(COMMONOBJECTS)
74 #
75 # Pretty print
76 #
77 V             = @
78 Q             = $(V:1=)
79 QUIET_CC      = $(Q:@=@echo    '     CC       '$@;)
80 QUIET_GEN     = $(Q:@=@echo    '     GEN      '$@;)
81 QUIET_LINK    = $(Q:@=@echo    '     LINK     '$@;)
83 EXECUTABLE=     k3conf
85 .PHONY: tags cscope
87 all:            $(EXECUTABLE)
89 $(EXECUTABLE):  $(ALLOBJECTS) builddate.o version.o
90                 $(QUIET_CC) $(CC) $(STATIC_BUILD) $(LDFLAGS) $(ALLOBJECTS) builddate.o version.o\
91                 -lrt -o $@
93 .c.o:
94                 $(QUIET_CC) $(CC) $(MYCFLAGS) $(LDFLAGS) -c $< -o $@
96 builddate.c:    $(ALLOBJECTS)
97                 @echo 'char *builddate="'`date`'";' > builddate.c
99 version.c:      $(ALLOBJECTS)
100                 @echo 'char *k3conf_version="'`git describe --dirty 2>/dev/null||echo "$(VERSION_MAJOR).$(VERSION_MINOR)-nogit"`'";' > version.c
102 tags: $(ALLSOURCES)
103         ctags $(shell $(CC) $(MYCFLAGS) -MM -MG $(ALLSOURCES) |\
104                         sed -e "s/^.*\.o://g"|tr -d '\\')
106 cscope: $(ALLSOURCES)
107         cscope -R -b
109 clean:
110                 @echo "Cleaning up..."
111                 -$(shell rm -f $(EXECUTABLE) *.o builddate.c version.c)
112                 -$(shell rm -f $(ALLOBJECTS))
113                 -$(shell rm -f tags cscope.out)
114                 @echo "Done."