Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 1 | # |
| 2 | # Makefile for musl (requires GNU make) |
| 3 | # |
| 4 | # This is how simple every makefile should be... |
| 5 | # No, I take that back - actually most should be less than half this size. |
| 6 | # |
| 7 | # Use config.mak to override any of the following variables. |
| 8 | # Do not make changes here. |
| 9 | # |
| 10 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 11 | srcdir = . |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 12 | exec_prefix = /usr/local |
| 13 | bindir = $(exec_prefix)/bin |
| 14 | |
| 15 | prefix = /usr/local/musl |
| 16 | includedir = $(prefix)/include |
| 17 | libdir = $(prefix)/lib |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 18 | syslibdir = /lib |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 19 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 20 | BASE_SRCS = $(sort $(wildcard $(srcdir)/src/*/*.c $(srcdir)/arch/$(ARCH)/src/*.c)) |
| 21 | BASE_OBJS = $(patsubst $(srcdir)/%.c,%.o,$(BASE_SRCS)) |
| 22 | ARCH_SRCS = $(wildcard $(srcdir)/src/*/$(ARCH)/*.s $(srcdir)/src/*/$(ARCH)$(ASMSUBARCH)/*.sub) |
| 23 | ARCH_OBJS = $(patsubst $(srcdir)/%.sub,%.o,$(patsubst $(srcdir)/%.s,%.o,$(ARCH_SRCS))) |
| 24 | REPLACED_OBJS = $(sort $(subst /$(ARCH)$(ASMSUBARCH)/,/,$(subst /$(ARCH)/,/,$(ARCH_OBJS))) $(subst /$(ARCH)$(ASMSUBARCH)/,/$(ARCH)/,$(subst /$(ARCH)/,/,$(ARCH_OBJS)))) |
| 25 | OBJS = $(addprefix obj/, $(filter-out $(REPLACED_OBJS), $(sort $(BASE_OBJS) $(ARCH_OBJS)))) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 26 | LOBJS = $(OBJS:.o=.lo) |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 27 | GENH = obj/include/bits/alltypes.h |
| 28 | GENH_INT = obj/src/internal/version.h |
| 29 | IMPH = $(addprefix $(srcdir)/, src/internal/stdio_impl.h src/internal/pthread_impl.h src/internal/libc.h) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 30 | |
Rich Felker | 4cd8b47 | 2015-11-02 16:58:14 -0500 | [diff] [blame] | 31 | LDFLAGS = |
| 32 | LDFLAGS_AUTO = |
Rich Felker | 1b23145 | 2012-08-02 21:05:43 -0400 | [diff] [blame] | 33 | LIBCC = -lgcc |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 34 | CPPFLAGS = |
Rich Felker | 4cd8b47 | 2015-11-02 16:58:14 -0500 | [diff] [blame] | 35 | CFLAGS = |
| 36 | CFLAGS_AUTO = -Os -pipe |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 37 | CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc |
| 38 | |
| 39 | CFLAGS_ALL = $(CFLAGS_C99FSE) |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 40 | CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -Iobj/src/internal -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include |
Rich Felker | 4cd8b47 | 2015-11-02 16:58:14 -0500 | [diff] [blame] | 41 | CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS) |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 42 | CFLAGS_ALL_STATIC = $(CFLAGS_ALL) |
Rich Felker | 9f74574 | 2012-09-14 23:38:10 -0400 | [diff] [blame] | 43 | CFLAGS_ALL_SHARED = $(CFLAGS_ALL) -fPIC -DSHARED |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 44 | |
Rich Felker | 4cd8b47 | 2015-11-02 16:58:14 -0500 | [diff] [blame] | 45 | LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS) |
| 46 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 47 | AR = $(CROSS_COMPILE)ar |
| 48 | RANLIB = $(CROSS_COMPILE)ranlib |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 49 | INSTALL = $(srcdir)/tools/install.sh |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 50 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 51 | ARCH_INCLUDES = $(wildcard $(srcdir)/arch/$(ARCH)/bits/*.h) |
| 52 | INCLUDES = $(wildcard $(srcdir)/include/*.h $(srcdir)/include/*/*.h) |
| 53 | ALL_INCLUDES = $(sort $(INCLUDES:$(srcdir)/%=%) $(GENH:obj/%=%) $(ARCH_INCLUDES:$(srcdir)/arch/$(ARCH)/%=include/%)) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 54 | |
Rich Felker | 41d5183 | 2011-02-24 16:37:21 -0500 | [diff] [blame] | 55 | EMPTY_LIB_NAMES = m rt pthread crypt util xnet resolv dl |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 56 | EMPTY_LIBS = $(EMPTY_LIB_NAMES:%=lib/lib%.a) |
Rich Felker | dc031ee | 2015-05-26 03:37:41 -0400 | [diff] [blame] | 57 | CRT_LIBS = lib/crt1.o lib/Scrt1.o lib/rcrt1.o lib/crti.o lib/crtn.o |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 58 | STATIC_LIBS = lib/libc.a |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 59 | SHARED_LIBS = lib/libc.so |
Rich Felker | 58f430c | 2012-04-22 14:32:49 -0400 | [diff] [blame] | 60 | TOOL_LIBS = lib/musl-gcc.specs |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 61 | ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS) |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 62 | ALL_TOOLS = obj/musl-gcc |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 63 | |
Shiz | b3cd7d1 | 2015-06-28 23:08:19 +0200 | [diff] [blame] | 64 | WRAPCC_GCC = gcc |
Shiz | fb58545 | 2015-06-28 23:08:21 +0200 | [diff] [blame] | 65 | WRAPCC_CLANG = clang |
Shiz | b3cd7d1 | 2015-06-28 23:08:19 +0200 | [diff] [blame] | 66 | |
Rich Felker | 3e7f186 | 2013-07-18 20:30:58 -0400 | [diff] [blame] | 67 | LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH)$(SUBARCH).so.1 |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 68 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 69 | -include config.mak |
| 70 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 71 | ifeq ($(ARCH),) |
| 72 | $(error Please set ARCH in config.mak before running make.) |
| 73 | endif |
| 74 | |
Rich Felker | 8d54681 | 2011-06-28 08:27:38 -0400 | [diff] [blame] | 75 | all: $(ALL_LIBS) $(ALL_TOOLS) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 76 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 77 | OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_LIBS) $(ALL_TOOLS) $(OBJS) $(GENH) $(GENH_INT))) $(addprefix obj/, crt crt/$(ARCH) include)) |
| 78 | |
| 79 | $(ALL_LIBS) $(ALL_TOOLS) $(CRT_LIBS:lib/%=obj/crt/%) $(OBJS) $(LOBJS) $(GENH) $(GENH_INT): | $(OBJ_DIRS) |
| 80 | |
| 81 | $(OBJ_DIRS): |
| 82 | mkdir -p $@ |
| 83 | |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 84 | install: install-libs install-headers install-tools |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 85 | |
| 86 | clean: |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 87 | rm -f obj/crt/*.o obj/crt/$(ARCH)/*.o |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 88 | rm -f $(OBJS) |
| 89 | rm -f $(LOBJS) |
Rich Felker | 127ab57 | 2011-02-17 17:57:26 -0500 | [diff] [blame] | 90 | rm -f $(ALL_LIBS) lib/*.[ao] lib/*.so |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 91 | rm -f $(ALL_TOOLS) |
Rich Felker | 179ab5a | 2013-12-01 17:27:25 -0500 | [diff] [blame] | 92 | rm -f $(GENH) $(GENH_INT) |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 93 | rm -f obj/include/bits/alltypes.h |
Rich Felker | 1355fdc | 2011-02-15 00:33:23 -0500 | [diff] [blame] | 94 | |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 95 | distclean: clean |
| 96 | rm -f config.mak |
| 97 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 98 | obj/include/bits/alltypes.h: $(srcdir)/arch/$(ARCH)/bits/alltypes.h.in $(srcdir)/include/alltypes.h.in $(srcdir)/tools/mkalltypes.sed |
| 99 | sed -f $(srcdir)/tools/mkalltypes.sed $(srcdir)/arch/$(ARCH)/bits/alltypes.h.in $(srcdir)/include/alltypes.h.in > $@ |
Rich Felker | 1355fdc | 2011-02-15 00:33:23 -0500 | [diff] [blame] | 100 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 101 | obj/src/internal/version.h: $(wildcard $(srcdir)/VERSION $(srcdir)/.git) |
| 102 | printf '#define VERSION "%s"\n' "$$(cd $(srcdir); sh tools/version.sh)" > $@ |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 103 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 104 | obj/src/internal/version.o obj/src/internal/version.lo: obj/src/internal/version.h |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 105 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 106 | obj/crt/rcrt1.o obj/src/ldso/dlstart.lo obj/src/ldso/dynlink.lo: $(srcdir)/src/internal/dynlink.h $(srcdir)/arch/$(ARCH)/reloc.h |
Rich Felker | 179ab5a | 2013-12-01 17:27:25 -0500 | [diff] [blame] | 107 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 108 | obj/crt/crt1.o obj/crt/scrt1.o obj/crt/rcrt1.o obj/src/ldso/dlstart.lo: $(srcdir)/arch/$(ARCH)/crt_arch.h |
Rich Felker | 179ab5a | 2013-12-01 17:27:25 -0500 | [diff] [blame] | 109 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 110 | obj/crt/rcrt1.o: $(srcdir)/src/ldso/dlstart.c |
Rich Felker | d043780 | 2012-08-05 12:32:20 -0400 | [diff] [blame] | 111 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 112 | obj/crt/Scrt1.o obj/crt/rcrt1.o: CFLAGS_ALL += -fPIC |
Rich Felker | 585ba14 | 2015-06-03 02:00:44 -0400 | [diff] [blame] | 113 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 114 | obj/crt/$(ARCH)/crti.o: $(srcdir)/crt/$(ARCH)/crti.s |
Rich Felker | c5e34da | 2013-07-26 01:49:14 -0400 | [diff] [blame] | 115 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 116 | obj/crt/$(ARCH)/crtn.o: $(srcdir)/crt/$(ARCH)/crtn.s |
Rich Felker | c5e34da | 2013-07-26 01:49:14 -0400 | [diff] [blame] | 117 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 118 | OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=$(srcdir)/src/%)) |
| 119 | $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo): CFLAGS += -O3 |
Rich Felker | a80847d | 2013-07-22 21:22:04 -0400 | [diff] [blame] | 120 | |
Rich Felker | 4a1f55e | 2013-08-01 17:12:23 -0400 | [diff] [blame] | 121 | MEMOPS_SRCS = src/string/memcpy.c src/string/memmove.c src/string/memcmp.c src/string/memset.c |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 122 | $(MEMOPS_SRCS:%.c=obj/%.o) $(MEMOPS_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_MEMOPS) |
Rich Felker | 4a1f55e | 2013-08-01 17:12:23 -0400 | [diff] [blame] | 123 | |
Rich Felker | 1ef849c | 2015-04-13 20:13:10 -0400 | [diff] [blame] | 124 | NOSSP_SRCS = $(wildcard crt/*.c) \ |
| 125 | src/env/__libc_start_main.c src/env/__init_tls.c \ |
| 126 | src/thread/__set_thread_area.c src/env/__stack_chk_fail.c \ |
| 127 | src/string/memset.c src/string/memcpy.c \ |
| 128 | src/ldso/dlstart.c src/ldso/dynlink.c |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 129 | $(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP) |
Rich Felker | 1ef849c | 2015-04-13 20:13:10 -0400 | [diff] [blame] | 130 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 131 | $(CRT_LIBS:lib/%=obj/crt/%): CFLAGS_ALL += -DCRT |
Rich Felker | de2b67f | 2015-04-19 22:05:29 -0400 | [diff] [blame] | 132 | |
Rich Felker | fb72a97 | 2013-08-14 02:50:25 -0400 | [diff] [blame] | 133 | # This incantation ensures that changes to any subarch asm files will |
| 134 | # force the corresponding object file to be rebuilt, even if the implicit |
| 135 | # rule below goes indirectly through a .sub file. |
| 136 | define mkasmdep |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 137 | $(patsubst $(srcdir)/%,obj/%,$(dir $(patsubst %/,%,$(dir $(1))))$(ARCH)$(ASMSUBARCH)/$(notdir $(1:.s=.o))): $(1) |
Rich Felker | fb72a97 | 2013-08-14 02:50:25 -0400 | [diff] [blame] | 138 | endef |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 139 | $(foreach s,$(wildcard $(srcdir)/src/*/$(ARCH)*/*.s),$(eval $(call mkasmdep,$(s)))) |
Rich Felker | fb72a97 | 2013-08-14 02:50:25 -0400 | [diff] [blame] | 140 | |
Alex Dowad | 35b3312 | 2015-07-10 15:03:24 +0200 | [diff] [blame] | 141 | # Choose invocation of assembler to be used |
| 142 | # $(1) is input file, $(2) is output file, $(3) is assembler flags |
| 143 | ifeq ($(ADD_CFI),yes) |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 144 | AS_CMD = LC_ALL=C awk -f $(srcdir)/tools/add-cfi.common.awk -f $(srcdir)/tools/add-cfi.$(ARCH).awk $< | $(CC) -x assembler -c -o $@ - |
Alex Dowad | 35b3312 | 2015-07-10 15:03:24 +0200 | [diff] [blame] | 145 | else |
| 146 | AS_CMD = $(CC) -c -o $@ $< |
| 147 | endif |
| 148 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 149 | obj/%.o: $(srcdir)/%.sub |
| 150 | $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $(dir $<)$$(cat $<) |
Rich Felker | 90d7772 | 2013-08-11 03:27:35 -0400 | [diff] [blame] | 151 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 152 | obj/%.o: $(srcdir)/%.s |
Alex Dowad | 35b3312 | 2015-07-10 15:03:24 +0200 | [diff] [blame] | 153 | $(AS_CMD) $(CFLAGS_ALL_STATIC) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 154 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 155 | obj/%.o: $(srcdir)/%.c $(GENH) $(IMPH) |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 156 | $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $< |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 157 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 158 | obj/%.lo: $(srcdir)/%.sub |
| 159 | $(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $(dir $<)$$(cat $<) |
Rich Felker | 804e994 | 2013-08-11 03:49:16 -0400 | [diff] [blame] | 160 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 161 | obj/%.lo: $(srcdir)/%.s |
Alex Dowad | 35b3312 | 2015-07-10 15:03:24 +0200 | [diff] [blame] | 162 | $(AS_CMD) $(CFLAGS_ALL_SHARED) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 163 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 164 | obj/%.lo: $(srcdir)/%.c $(GENH) $(IMPH) |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 165 | $(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $< |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 166 | |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 167 | lib/libc.so: $(LOBJS) |
Rich Felker | 4cd8b47 | 2015-11-02 16:58:14 -0500 | [diff] [blame] | 168 | $(CC) $(CFLAGS_ALL_SHARED) $(LDFLAGS_ALL) -nostdlib -shared \ |
Rich Felker | 3fa2eb2 | 2014-06-20 00:25:12 -0400 | [diff] [blame] | 169 | -Wl,-e,_dlstart -Wl,-Bsymbolic-functions \ |
Rich Felker | dfdc337 | 2013-03-09 22:34:11 -0500 | [diff] [blame] | 170 | -o $@ $(LOBJS) $(LIBCC) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 171 | |
Rich Felker | 4fd1595 | 2011-02-17 17:12:52 -0500 | [diff] [blame] | 172 | lib/libc.a: $(OBJS) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 173 | rm -f $@ |
| 174 | $(AR) rc $@ $(OBJS) |
| 175 | $(RANLIB) $@ |
| 176 | |
Rich Felker | 4fd1595 | 2011-02-17 17:12:52 -0500 | [diff] [blame] | 177 | $(EMPTY_LIBS): |
| 178 | rm -f $@ |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 179 | $(AR) rc $@ |
| 180 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 181 | lib/%.o: obj/crt/%.o |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 182 | cp $< $@ |
| 183 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 184 | lib/crti.o: obj/crt/$(ARCH)/crti.o |
| 185 | cp $< $@ |
| 186 | |
| 187 | lib/crtn.o: obj/crt/$(ARCH)/crtn.o |
| 188 | cp $< $@ |
| 189 | |
| 190 | lib/musl-gcc.specs: $(srcdir)/tools/musl-gcc.specs.sh config.mak |
Rich Felker | 58f430c | 2012-04-22 14:32:49 -0400 | [diff] [blame] | 191 | sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" > $@ |
| 192 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 193 | obj/musl-gcc: config.mak |
Shiz | b3cd7d1 | 2015-06-28 23:08:19 +0200 | [diff] [blame] | 194 | printf '#!/bin/sh\nexec "$${REALGCC:-$(WRAPCC_GCC)}" "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@ |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 195 | chmod +x $@ |
| 196 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 197 | obj/%-clang: $(srcdir)/tools/%-clang.in config.mak |
Shiz | fb58545 | 2015-06-28 23:08:21 +0200 | [diff] [blame] | 198 | sed -e 's!@CC@!$(WRAPCC_CLANG)!g' -e 's!@PREFIX@!$(prefix)!g' -e 's!@INCDIR@!$(includedir)!g' -e 's!@LIBDIR@!$(libdir)!g' -e 's!@LDSO@!$(LDSO_PATHNAME)!g' $< > $@ |
| 199 | chmod +x $@ |
| 200 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 201 | $(DESTDIR)$(bindir)/%: obj/% |
Rich Felker | e678fc6 | 2013-08-17 22:21:11 -0400 | [diff] [blame] | 202 | $(INSTALL) -D $< $@ |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 203 | |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 204 | $(DESTDIR)$(libdir)/%.so: lib/%.so |
Rich Felker | e678fc6 | 2013-08-17 22:21:11 -0400 | [diff] [blame] | 205 | $(INSTALL) -D -m 755 $< $@ |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 206 | |
Rich Felker | ec05a0b | 2011-06-23 22:13:47 -0400 | [diff] [blame] | 207 | $(DESTDIR)$(libdir)/%: lib/% |
Rich Felker | e678fc6 | 2013-08-17 22:21:11 -0400 | [diff] [blame] | 208 | $(INSTALL) -D -m 644 $< $@ |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 209 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 210 | $(DESTDIR)$(includedir)/bits/%: $(srcdir)/arch/$(ARCH)/bits/% |
Rich Felker | e678fc6 | 2013-08-17 22:21:11 -0400 | [diff] [blame] | 211 | $(INSTALL) -D -m 644 $< $@ |
Rich Felker | d66ab4f | 2013-07-01 13:43:43 -0400 | [diff] [blame] | 212 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 213 | $(DESTDIR)$(includedir)/bits/%: obj/include/bits/% |
| 214 | $(INSTALL) -D -m 644 $< $@ |
| 215 | |
| 216 | $(DESTDIR)$(includedir)/%: $(srcdir)/include/% |
Rich Felker | e678fc6 | 2013-08-17 22:21:11 -0400 | [diff] [blame] | 217 | $(INSTALL) -D -m 644 $< $@ |
Rich Felker | ec05a0b | 2011-06-23 22:13:47 -0400 | [diff] [blame] | 218 | |
Rich Felker | 82fa6b4 | 2013-08-16 17:51:38 -0400 | [diff] [blame] | 219 | $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so |
Rich Felker | 9ff8ed4 | 2013-08-31 11:36:56 -0400 | [diff] [blame] | 220 | $(INSTALL) -D -l $(libdir)/libc.so $@ || true |
Rich Felker | f8e054f | 2012-05-04 21:54:57 -0400 | [diff] [blame] | 221 | |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 222 | install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),) |
| 223 | |
| 224 | install-headers: $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%) |
| 225 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 226 | install-tools: $(ALL_TOOLS:obj/%=$(DESTDIR)$(bindir)/%) |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 227 | |
Rich Felker | f807107 | 2014-06-25 16:14:37 -0400 | [diff] [blame] | 228 | musl-git-%.tar.gz: .git |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 229 | git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ $(patsubst musl-git-%.tar.gz,%,$@) |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 230 | |
Rich Felker | f807107 | 2014-06-25 16:14:37 -0400 | [diff] [blame] | 231 | musl-%.tar.gz: .git |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame^] | 232 | git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ v$(patsubst musl-%.tar.gz,%,$@) |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 233 | |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 234 | .PHONY: all clean install install-libs install-headers install-tools |