]>
Commit | Line | Data |
---|---|---|
a6316ce4 MT |
1 | # libhd/Makefile.common |
2 | ||
3 | ARCH := $(shell uname -m) | |
4 | ifeq "$(ARCH)" "i486" | |
5 | ARCH := i386 | |
6 | endif | |
7 | ifeq "$(ARCH)" "i586" | |
8 | ARCH := i386 | |
9 | endif | |
10 | ifeq "$(ARCH)" "i686" | |
11 | ARCH := i386 | |
12 | endif | |
13 | ifeq "$(ARCH)" "parisc" | |
14 | EXTRA_FLAGS := -fPIC $(EXTRA_FLAGS) | |
15 | endif | |
16 | ||
17 | LIBHD_VERSION := $(shell cat $(TOPDIR)/VERSION) | |
18 | LIBHD_MINOR_VERSION := $(shell cut -d . -f 2 $(TOPDIR)/VERSION) | |
19 | LIBHD_MAJOR_VERSION := $(shell cut -d . -f 1 $(TOPDIR)/VERSION) | |
20 | ||
21 | CC = gcc | |
22 | LD = ld | |
23 | CFLAGS = -Wall -O2 -pipe -g $(SHARED_FLAGS) $(EXTRA_FLAGS) -I/opt/i586-uClibc/include -I/opt/i586-uClibc/usr/include -I$(TOPDIR)/src/hd | |
24 | SHARED_FLAGS = -fPIC | |
25 | ||
26 | LDFLAGS = -Lsrc | |
27 | ||
28 | CFILES = $(wildcard *.c) | |
29 | OBJS = $(CFILES:.c=.o) | |
30 | LIBHD_BASE = libhd | |
31 | LIBHD = $(TOPDIR)/src/$(LIBHD_BASE).a | |
32 | LIBHD_SONAME = $(LIBHD_BASE).so.$(LIBHD_MAJOR_VERSION) | |
33 | LIBHD_NAME = $(LIBHD_BASE).so.$(LIBHD_VERSION) | |
34 | LIBHD_SO = $(TOPDIR)/src/$(LIBHD_NAME) | |
35 | LIBHD_D = $(TOPDIR)/src/.lib | |
36 | ||
37 | export CC TOPDIR CFLAGS LIBHD ARCH | |
38 | ||
39 | .PHONY: all distclean clean install subdirs | |
40 | ||
41 | %.o: %.c | |
42 | $(CC) -c $(CFLAGS) $< | |
43 | ||
44 | all: subdirs $(TARGETS) | |
45 | ||
46 | install: all | |
47 | ||
48 | ifneq "$(SUBDIRS)" "" | |
49 | subdirs: | |
50 | @for i in $(SUBDIRS) ; do make -C $$i $(MAKECMDGOALS) || exit ; done | |
51 | endif | |
52 | ||
53 | clean: subdirs | |
54 | @rm -rf $(OBJS) .depend $(CLEANFILES) *~ | |
55 | ||
56 | distclean: subdirs | |
57 | @rm -rf $(OBJS) .depend $(CLEANFILES) $(DISTCLEANFILES) *~ | |
58 | ||
59 | ifneq "$(CFILES)" "" | |
60 | ifeq ($(findstring $(MAKECMDGOALS), clean distclean),) | |
61 | .depend: $(CFILES) | |
62 | @$(CC) -MG -MM $(CFLAGS) $(CFILES) >$@ | |
63 | ||
64 | -include .depend | |
65 | endif | |
66 | endif |