brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 53e0245 Raw
91 lines · plain
1# Makefile - requires GNU make2#3# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4# See https://llvm.org/LICENSE.txt for license information.5# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6 7srcdir = .8prefix = /usr9bindir = $(prefix)/bin10libdir = $(prefix)/lib11includedir = $(prefix)/include12 13# Configure these in config.mk, do not make changes in this file.14SUBS = math string networking15HOST_CC = cc16HOST_CFLAGS = -std=c99 -O217HOST_LDFLAGS =18HOST_LDLIBS =19EMULATOR =20CPPFLAGS =21CFLAGS = -std=c99 -O222CFLAGS_SHARED = -fPIC23CFLAGS_ALL = -Ibuild/include $(CPPFLAGS) $(CFLAGS)24LDFLAGS =25LDLIBS =26AR = $(CROSS_COMPILE)ar27RANLIB = $(CROSS_COMPILE)ranlib28INSTALL = install29 30all:31 32-include config.mk33 34$(foreach sub,$(SUBS),$(eval include $(srcdir)/$(sub)/Dir.mk))35 36# Required targets of subproject foo:37#   all-foo38#   check-foo39#   clean-foo40#   install-foo41# Required make variables of subproject foo:42#   foo-files: Built files (all in build/).43# Make variables used by subproject foo:44#   foo-...: Variables defined in foo/Dir.mk or by config.mk.45 46all: $(SUBS:%=all-%)47 48ALL_FILES = $(foreach sub,$(SUBS),$($(sub)-files))49DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_FILES))))50$(ALL_FILES): | $(DIRS)51$(DIRS):52	mkdir -p $@53 54$(filter %.os,$(ALL_FILES)): CFLAGS_ALL += $(CFLAGS_SHARED)55 56build/%.o: $(srcdir)/%.S57	$(CC) $(CFLAGS_ALL) -c -o $@ $<58 59build/%.o: $(srcdir)/%.c60	$(CC) $(CFLAGS_ALL) -c -o $@ $<61 62build/%.os: $(srcdir)/%.S63	$(CC) $(CFLAGS_ALL) -c -o $@ $<64 65build/%.os: $(srcdir)/%.c66	$(CC) $(CFLAGS_ALL) -c -o $@ $<67 68clean: $(SUBS:%=clean-%)69	rm -rf build70 71distclean: clean72	rm -f config.mk73 74$(DESTDIR)$(bindir)/%: build/bin/%75	$(INSTALL) -D $< $@76 77$(DESTDIR)$(libdir)/%.so: build/lib/%.so78	$(INSTALL) -D $< $@79 80$(DESTDIR)$(libdir)/%: build/lib/%81	$(INSTALL) -m 644 -D $< $@82 83$(DESTDIR)$(includedir)/%: build/include/%84	$(INSTALL) -m 644 -D $< $@85 86install: $(SUBS:%=install-%)87 88check: $(SUBS:%=check-%)89 90.PHONY: all clean distclean install check91