forked from openSUSE/hwinfo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.common
70 lines (54 loc) · 1.52 KB
/
Makefile.common
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# libhd/Makefile.common
ARCH := $(shell uname -m)
ifeq "$(ARCH)" "i486"
ARCH := i386
endif
ifeq "$(ARCH)" "i586"
ARCH := i386
endif
ifeq "$(ARCH)" "i686"
ARCH := i386
endif
ifeq "$(ARCH)" "parisc"
EXTRA_FLAGS := -fPIC $(EXTRA_FLAGS)
endif
LIBHD_VERSION := $(shell cat $(TOPDIR)/VERSION)
LIBHD_MINOR_VERSION := $(shell cut -d . -f 2 $(TOPDIR)/VERSION)
LIBHD_MAJOR_VERSION := $(shell cut -d . -f 1 $(TOPDIR)/VERSION)
RPM_OPT_FLAGS ?= -O2
CC ?= gcc
LD = ld
CFLAGS += $(RPM_OPT_FLAGS) -Wall -Wno-pointer-sign -pipe -g $(SHARED_FLAGS) $(EXTRA_FLAGS) -I$(TOPDIR)/src/hd
SHARED_FLAGS = -fPIC -fvisibility=hidden
LDFLAGS += -Lsrc
CFILES = $(sort $(wildcard *.c))
OBJS = $(CFILES:.c=.o)
LIBHD_BASE = libhd
LIBHD = $(TOPDIR)/src/$(LIBHD_BASE).a
LIBHD_SONAME = $(LIBHD_BASE).so.$(LIBHD_MAJOR_VERSION)
LIBHD_NAME = $(LIBHD_BASE).so.$(LIBHD_VERSION)
LIBHD_SO = $(TOPDIR)/src/$(LIBHD_NAME)
LIBHD_D = $(TOPDIR)/src/.lib
export CC TOPDIR CFLAGS LIBHD ARCH
.PHONY: all distclean clean install subdirs
%.o: %.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $<
all: subdirs $(TARGETS)
install: all
ifneq "$(SUBDIRS)" ""
subdirs:
@for i in $(SUBDIRS) ; do make -C $$i $(MAKECMDGOALS) || exit ; done
endif
clean: subdirs
@rm -rf $(OBJS) .depend $(CLEANFILES) *~
@rm -rf package
distclean: subdirs
@rm -rf $(OBJS) .depend $(CLEANFILES) $(DISTCLEANFILES) *~
@rm -rf package
ifneq "$(CFILES)" ""
ifeq ($(findstring $(MAKECMDGOALS), clean distclean),)
.depend: $(CFILES)
@$(CC) -MG -MM $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(CFILES) >$@
-include .depend
endif
endif