Changeset 1361

Show
Ignore:
Timestamp:
04/29/02 03:37:07 (7 years ago)
Author:
mds
Message:

use $CFLAGS and $CPPFLAGS from environment or if specified

in Makfile. Patch from

"Kevin P. Fleming" <kevin@labsysgrp.com>

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/CHANGES

    r1351 r1361  
    2626             kernel/drivers/[i2c,sensors] , not misc/ , and 
    2727             removes old versions in misc/ . 
     28             Use $CFLAGS and $CPPFLAGS if defined. 
    2829  Module i2c-savage4: new 
    2930  Module i2c-viapro: Add support for VT8233A (0x3147) 
    3031  Module w83781d: Add multiple VRM version support 
     32  Program eeprom: new 
    3133  Program mkpatch: Install new sensors_vid.h 
     34  Program sensord: Major update, add rrd support 
    3235  Program sensors-detect: Add VT8233A, several S3 devices; fix perl warnings 
    3336 
  • lm-sensors/trunk/Makefile

    r1359 r1361  
    126126# PROG_EXTRA := sensord 
    127127 
     128# Set these to add preprocessor or compiler flags, or use 
     129# environment variables 
     130# CFLAGS := 
     131# CPPFLAGS := 
     132 
    128133################################################## 
    129134# Below this, nothing should need to be changed. # 
     
    160165 
    161166# Determine the default compiler flags 
    162 # MODCFLAGS is to create in-kernel object files (modules); PROGFLAGS is to 
    163 # create non-kernel object files (which are linked into executables). 
    164 # ARCFLAGS are used to create archive object files (static libraries), and 
    165 # LIBCFLAGS are for shared library objects. 
    166 CFLAGS := -I. -Ikernel/include -I$(I2C_HEADERS) -I$(LINUX_HEADERS) -O2  
     167# Set CFLAGS or CPPFLAGS above to add your own flags to all. 
     168# ALLCPPFLAGS/ALLCFLAGS are common flags, plus any user-specified overrides from the environment or make command line. 
     169# MODCPPFLAGS/MODCFLAGS is to create in-kernel object files (modules). 
     170# PROGCPPFLAGS/PROGCFLAGS is to create non-kernel object files (which are linked into executables). 
     171# ARCPPFLAGS/ARCFLAGS are used to create archive object files (static libraries). 
     172# LIBCPPFLAGS/LIBCFLAGS are for shared library objects. 
     173ALL_CPPFLAGS := -I. -Ikernel/include -I$(I2C_HEADERS) -I$(LINUX_HEADERS) 
     174ALL_CFLAGS := -O2  
    167175 
    168176ifeq ($(DEBUG),1) 
    169 CFLAGS += -DDEBUG 
     177ALL_CPPFLAGS += -DDEBUG 
    170178endif 
    171179 
    172180ifeq ($(WARN),1) 
    173 CFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ 
    174           -Wcast-align -Wwrite-strings -Wnested-externs -Winline 
    175 endif 
    176  
    177 MODCFLAGS := $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer  
    178 MODCFLAGS := $(MODCFLAGS) -DEXPORT_SYMTAB 
    179 PROGCFLAGS := $(CFLAGS) 
    180 ARCFLAGS := $(CFLAGS) 
    181 LIBCFLAGS := $(CFLAGS) -fpic 
     181ALL_CFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ 
     182            -Wcast-align -Wwrite-strings -Wnested-externs -Winline 
     183endif 
     184 
     185ALL_CPPFLAGS += $(CPPFLAGS) 
     186ALL_CFLAGS += $(CFLAGS) 
     187 
     188MODCPPFLAGS := 
     189MODCFLAGS := 
    182190 
    183191ifeq ($(MACHINE),alpha) 
     
    186194 
    187195ifeq ($(SMP),1) 
    188 MODCFLAGS += -D__SMP__ 
     196MODCPPFLAGS += -D__SMP__ 
    189197endif 
    190198 
    191199ifeq ($(MODVER),1) 
    192 MODCFLAGS += -DMODVERSIONS -include $(LINUX_HEADERS)/linux/modversions.h 
    193 endif 
     200MODCPPFLAGS += -DMODVERSIONS -include $(LINUX_HEADERS)/linux/modversions.h 
     201endif 
     202 
     203MODCPPFLAGS += -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -fomit-frame-pointer $(ALL_CPPFLAGS) 
     204MODCFLAGS += $(ALL_CFLAGS) 
     205PROGCPPFLAGS := $(ALL_CPPFLAGS) 
     206PROGCFLAGS := $(ALL_CFLAGS) 
     207ARCPPFLAGS := $(ALL_CPPFLAGS) 
     208ARCFLAGS := $(ALL_CFLAGS) 
     209LIBCPPFLAGS := $(ALL_CPPFLAGS) 
     210LIBCFLAGS := -fpic $(ALL_CFLAGS) 
    194211 
    195212.PHONY: all clean install version package dep 
     
    247264# .o files are used for modules 
    248265%.o: %.c 
    249         $(CC) $(MODCFLAGS) -c $< -o $@ 
     266        $(CC) $(MODCPPFLAGS) $(MODCFLAGS) -c $< -o $@ 
    250267 
    251268%.d: %.c 
    252         $(CC) -M -MG $(MODCFLAGS) $< | \ 
     269        $(CC) -M -MG $(MODCPPFLAGS) $(MODCFLAGS) $< | \ 
    253270        sed -e 's@^\(.*\)\.o:@$*.d $*.o: Makefile '`dirname $*.d`/Module.mk' @' > $@ 
    254271 
     
    257274# .ro files are used for programs (as opposed to modules) 
    258275%.ro: %.c 
    259         $(CC) $(PROGCFLAGS) -c $< -o $@ 
     276        $(CC) $(PROGCPPFLAGS) $(PROGCFLAGS) -c $< -o $@ 
    260277 
    261278%.rd: %.c 
    262         $(CC) -M -MG $(PROGCFLAGS) $< | \ 
     279        $(CC) -M -MG $(PROGCPPFLAGS) $(PROGCFLAGS) $< | \ 
    263280        sed -e 's@^\(.*\)\.o:@$*.rd $*.ro: Makefile '`dirname $*.rd`/Module.mk' @' > $@ 
    264281 
     
    270287# .ao files are used for static archives 
    271288%.ao: %.c 
    272         $(CC) $(ARCFLAGS) -c $< -o $@ 
     289        $(CC) $(ARCPPFLAGS) $(ARCFLAGS) -c $< -o $@ 
    273290 
    274291%.ad: %.c 
    275         $(CC) -M -MG $(ARCFLAGS) $< | \ 
     292        $(CC) -M -MG $(ARCPPFLAGS) $(ARCFLAGS) $< | \ 
    276293        sed -e 's@^\(.*\)\.o:@$*.ad $*.ao: Makefile '`dirname $*.ad`/Module.mk' @' > $@ 
    277294 
     
    279296# .lo files are used for shared libraries 
    280297%.lo: %.c 
    281         $(CC) $(LIBCFLAGS) -c $< -o $@ 
     298        $(CC) $(LIBCPPFLAGS) $(LIBCFLAGS) -c $< -o $@ 
    282299 
    283300%.ld: %.c 
    284         $(CC) -M -MG $(LIBCFLAGS) $< | \ 
     301        $(CC) -M -MG $(LIBCPPFLAGS) $(LIBCFLAGS) $< | \ 
    285302        sed -e 's@^\(.*\)\.o:@$*.ld $*.lo: Makefile '`dirname $*.ld`/Module.mk' @' > $@ 
    286303