~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/sched_ext/Makefile

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/sched_ext/Makefile (Version linux-6.12-rc7) and /tools/sched_ext/Makefile (Version linux-4.4.302)


  1 # SPDX-License-Identifier: GPL-2.0                
  2 # Copyright (c) 2022 Meta Platforms, Inc. and     
  3 include ../build/Build.include                    
  4 include ../scripts/Makefile.arch                  
  5 include ../scripts/Makefile.include               
  6                                                   
  7 all: all_targets                                  
  8                                                   
  9 ifneq ($(LLVM),)                                  
 10 ifneq ($(filter %/,$(LLVM)),)                     
 11 LLVM_PREFIX := $(LLVM)                            
 12 else ifneq ($(filter -%,$(LLVM)),)                
 13 LLVM_SUFFIX := $(LLVM)                            
 14 endif                                             
 15                                                   
 16 CLANG_TARGET_FLAGS_arm          := arm-linux-g    
 17 CLANG_TARGET_FLAGS_arm64        := aarch64-lin    
 18 CLANG_TARGET_FLAGS_hexagon      := hexagon-lin    
 19 CLANG_TARGET_FLAGS_m68k         := m68k-linux-    
 20 CLANG_TARGET_FLAGS_mips         := mipsel-linu    
 21 CLANG_TARGET_FLAGS_powerpc      := powerpc64le    
 22 CLANG_TARGET_FLAGS_riscv        := riscv64-lin    
 23 CLANG_TARGET_FLAGS_s390         := s390x-linux    
 24 CLANG_TARGET_FLAGS_x86          := x86_64-linu    
 25 CLANG_TARGET_FLAGS              := $(CLANG_TAR    
 26                                                   
 27 ifeq ($(CROSS_COMPILE),)                          
 28 ifeq ($(CLANG_TARGET_FLAGS),)                     
 29 $(error Specify CROSS_COMPILE or add '--target    
 30 else                                              
 31 CLANG_FLAGS     += --target=$(CLANG_TARGET_FLA    
 32 endif # CLANG_TARGET_FLAGS                        
 33 else                                              
 34 CLANG_FLAGS     += --target=$(notdir $(CROSS_C    
 35 endif # CROSS_COMPILE                             
 36                                                   
 37 CC := $(LLVM_PREFIX)clang$(LLVM_SUFFIX) $(CLAN    
 38 else                                              
 39 CC := $(CROSS_COMPILE)gcc                         
 40 endif # LLVM                                      
 41                                                   
 42 CURDIR := $(abspath .)                            
 43 TOOLSDIR := $(abspath ..)                         
 44 LIBDIR := $(TOOLSDIR)/lib                         
 45 BPFDIR := $(LIBDIR)/bpf                           
 46 TOOLSINCDIR := $(TOOLSDIR)/include                
 47 BPFTOOLDIR := $(TOOLSDIR)/bpf/bpftool             
 48 APIDIR := $(TOOLSINCDIR)/uapi                     
 49 GENDIR := $(abspath ../../include/generated)      
 50 GENHDR := $(GENDIR)/autoconf.h                    
 51                                                   
 52 ifeq ($(O),)                                      
 53 OUTPUT_DIR := $(CURDIR)/build                     
 54 else                                              
 55 OUTPUT_DIR := $(O)/build                          
 56 endif # O                                         
 57 OBJ_DIR := $(OUTPUT_DIR)/obj                      
 58 INCLUDE_DIR := $(OUTPUT_DIR)/include              
 59 BPFOBJ_DIR := $(OBJ_DIR)/libbpf                   
 60 SCXOBJ_DIR := $(OBJ_DIR)/sched_ext                
 61 BINDIR := $(OUTPUT_DIR)/bin                       
 62 BPFOBJ := $(BPFOBJ_DIR)/libbpf.a                  
 63 ifneq ($(CROSS_COMPILE),)                         
 64 HOST_BUILD_DIR          := $(OBJ_DIR)/host        
 65 HOST_OUTPUT_DIR := host-tools                     
 66 HOST_INCLUDE_DIR        := $(HOST_OUTPUT_DIR)/    
 67 else                                              
 68 HOST_BUILD_DIR          := $(OBJ_DIR)             
 69 HOST_OUTPUT_DIR := $(OUTPUT_DIR)                  
 70 HOST_INCLUDE_DIR        := $(INCLUDE_DIR)         
 71 endif                                             
 72 HOST_BPFOBJ := $(HOST_BUILD_DIR)/libbpf/libbpf    
 73 RESOLVE_BTFIDS := $(HOST_BUILD_DIR)/resolve_bt    
 74 DEFAULT_BPFTOOL := $(HOST_OUTPUT_DIR)/sbin/bpf    
 75                                                   
 76 VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux)      
 77                      $(if $(KBUILD_OUTPUT),$(K    
 78                      ../../vmlinux                
 79                      /sys/kernel/btf/vmlinux      
 80                      /boot/vmlinux-$(shell una    
 81 VMLINUX_BTF ?= $(abspath $(firstword $(wildcar    
 82 ifeq ($(VMLINUX_BTF),)                            
 83 $(error Cannot find a vmlinux for VMLINUX_BTF     
 84 endif                                             
 85                                                   
 86 BPFTOOL ?= $(DEFAULT_BPFTOOL)                     
 87                                                   
 88 ifneq ($(wildcard $(GENHDR)),)                    
 89   GENFLAGS := -DHAVE_GENHDR                       
 90 endif                                             
 91                                                   
 92 CFLAGS += -g -O2 -rdynamic -pthread -Wall -Wer    
 93           -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIB    
 94           -I$(TOOLSINCDIR) -I$(APIDIR) -I$(CUR    
 95                                                   
 96 # Silence some warnings when compiled with cla    
 97 ifneq ($(LLVM),)                                  
 98 CFLAGS += -Wno-unused-command-line-argument       
 99 endif                                             
100                                                   
101 LDFLAGS = -lelf -lz -lpthread                     
102                                                   
103 IS_LITTLE_ENDIAN = $(shell $(CC) -dM -E - </de    
104                         grep 'define __BYTE_OR    
105                                                   
106 # Get Clang's default includes on this system,    
107 # '-target bpf'. This fixes "missing" files on    
108 # such as asm/byteorder.h, asm/socket.h, asm/s    
109 #                                                 
110 # Use '-idirafter': Don't interfere with inclu    
111 # build would have failed anyways.                
112 define get_sys_includes                           
113 $(shell $(1) -v -E - </dev/null 2>&1 \            
114         | sed -n '/<...> search starts here:/,    
115 $(shell $(1) -dM -E - </dev/null | grep '__ris    
116 endef                                             
117                                                   
118 BPF_CFLAGS = -g -D__TARGET_ARCH_$(SRCARCH)        
119              $(if $(IS_LITTLE_ENDIAN),-mlittle    
120              -I$(CURDIR)/include -I$(CURDIR)/i    
121              -I$(INCLUDE_DIR) -I$(APIDIR)         
122              -I../../include                      
123              $(call get_sys_includes,$(CLANG))    
124              -Wall -Wno-compare-distinct-point    
125              -O2 -mcpu=v3                         
126                                                   
127 # sort removes libbpf duplicates when not cros    
128 MAKE_DIRS := $(sort $(OBJ_DIR)/libbpf $(HOST_B    
129                $(HOST_BUILD_DIR)/bpftool $(HOS    
130                $(INCLUDE_DIR) $(SCXOBJ_DIR) $(    
131                                                   
132 $(MAKE_DIRS):                                     
133         $(call msg,MKDIR,,$@)                     
134         $(Q)mkdir -p $@                           
135                                                   
136 $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDI    
137            $(APIDIR)/linux/bpf.h                  
138            | $(OBJ_DIR)/libbpf                    
139         $(Q)$(MAKE) $(submake_extras) -C $(BPF    
140                     EXTRA_CFLAGS='-g -O0 -fPIC    
141                     DESTDIR=$(OUTPUT_DIR) pref    
142                                                   
143 $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*    
144                     $(HOST_BPFOBJ) | $(HOST_BU    
145         $(Q)$(MAKE) $(submake_extras)  -C $(BP    
146                     ARCH= CROSS_COMPILE= CC=$(    
147                     EXTRA_CFLAGS='-g -O0'         
148                     OUTPUT=$(HOST_BUILD_DIR)/b    
149                     LIBBPF_OUTPUT=$(HOST_BUILD    
150                     LIBBPF_DESTDIR=$(HOST_OUTP    
151                     prefix= DESTDIR=$(HOST_OUT    
152                                                   
153 $(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) $(BPF    
154 ifeq ($(VMLINUX_H),)                              
155         $(call msg,GEN,,$@)                       
156         $(Q)$(BPFTOOL) btf dump file $(VMLINUX    
157 else                                              
158         $(call msg,CP,,$@)                        
159         $(Q)cp "$(VMLINUX_H)" $@                  
160 endif                                             
161                                                   
162 $(SCXOBJ_DIR)/%.bpf.o: %.bpf.c $(INCLUDE_DIR)/    
163                        | $(BPFOBJ) $(SCXOBJ_DI    
164         $(call msg,CLNG-BPF,,$(notdir $@))        
165         $(Q)$(CLANG) $(BPF_CFLAGS) -target bpf    
166                                                   
167 $(INCLUDE_DIR)/%.bpf.skel.h: $(SCXOBJ_DIR)/%.b    
168         $(eval sched=$(notdir $@))                
169         $(call msg,GEN-SKEL,,$(sched))            
170         $(Q)$(BPFTOOL) gen object $(<:.o=.link    
171         $(Q)$(BPFTOOL) gen object $(<:.o=.link    
172         $(Q)$(BPFTOOL) gen object $(<:.o=.link    
173         $(Q)diff $(<:.o=.linked2.o) $(<:.o=.li    
174         $(Q)$(BPFTOOL) gen skeleton $(<:.o=.li    
175         $(Q)$(BPFTOOL) gen subskeleton $(<:.o=    
176                                                   
177 SCX_COMMON_DEPS := include/scx/common.h includ    
178                                                   
179 c-sched-targets = scx_simple scx_qmap scx_cent    
180                                                   
181 $(addprefix $(BINDIR)/,$(c-sched-targets)): \     
182         $(BINDIR)/%: \                            
183                 $(filter-out %.bpf.c,%.c) \       
184                 $(INCLUDE_DIR)/%.bpf.skel.h \     
185                 $(SCX_COMMON_DEPS)                
186         $(eval sched=$(notdir $@))                
187         $(CC) $(CFLAGS) -c $(sched).c -o $(SCX    
188         $(CC) -o $@ $(SCXOBJ_DIR)/$(sched).o $    
189                                                   
190 $(c-sched-targets): %: $(BINDIR)/%                
191                                                   
192 install: all                                      
193         $(Q)mkdir -p $(DESTDIR)/usr/local/bin/    
194         $(Q)cp $(BINDIR)/* $(DESTDIR)/usr/loca    
195                                                   
196 clean:                                            
197         rm -rf $(OUTPUT_DIR) $(HOST_OUTPUT_DIR    
198         rm -f *.o *.bpf.o *.bpf.skel.h *.bpf.s    
199         rm -f $(c-sched-targets)                  
200                                                   
201 help:                                             
202         @echo   'Building targets'                
203         @echo   '================'                
204         @echo   ''                                
205         @echo   '  all            - Compile al    
206         @echo   ''                                
207         @echo   'Alternatively, you may compil    
208         @echo   ''                                
209         @printf '  %s\n' $(c-sched-targets)       
210         @echo   ''                                
211         @echo   'For any scheduler build targe    
212         @echo   'build output path with the O=    
213         @echo   ''                                
214         @echo   '   O=/tmp/sched_ext make all'    
215         @echo   ''                                
216         @echo   'will compile all schedulers,     
217         @echo   '/tmp/sched_ext/build.'           
218         @echo   ''                                
219         @echo   ''                                
220         @echo   'Installing targets'              
221         @echo   '=================='              
222         @echo   ''                                
223         @echo   '  install        - Compile an    
224         @echo   '                   You may sp    
225         @echo   '                   to indicat    
226         @echo   ''                                
227         @echo   '                     DESTDIR=    
228         @echo   ''                                
229         @echo   '                   will build    
230         @echo   '                   install th    
231         @echo   ''                                
232         @echo   ''                                
233         @echo   'Cleaning targets'                
234         @echo   '================'                
235         @echo   ''                                
236         @echo   '  clean                  - Re    
237                                                   
238 all_targets: $(c-sched-targets)                   
239                                                   
240 .PHONY: all all_targets $(c-sched-targets) cle    
241                                                   
242 # delete failed targets                           
243 .DELETE_ON_ERROR:                                 
244                                                   
245 # keep intermediate (.bpf.skel.h, .bpf.o, etc)    
246 .SECONDARY:                                       
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php