Home | History | Annotate | Line # | Download | only in unix
Makefile.common revision 1.1
      1  1.1  christos #
      2  1.1  christos # Common make for acpica tools and utilities
      3  1.1  christos #
      4  1.1  christos 
      5  1.1  christos #
      6  1.1  christos # Get the OS machine architecture. Anything with a "64" in the returned
      7  1.1  christos # string will be treated as a 64-bit OS. Otherwise, the default is 32-bit.
      8  1.1  christos #
      9  1.1  christos ifeq ($(HOST), _FreeBSD)
     10  1.1  christos HARDWARE_NAME := $(shell uname -p)
     11  1.1  christos else
     12  1.1  christos HARDWARE_NAME := $(shell uname -m)
     13  1.1  christos endif
     14  1.1  christos 
     15  1.1  christos #
     16  1.1  christos # Main rule will only generate versions that are appropriate for the running
     17  1.1  christos # OS, either 64-bit or 32-bit.
     18  1.1  christos #
     19  1.1  christos all:	$(PROGS)
     20  1.1  christos $(PROGS): FORCE
     21  1.1  christos 	@cd $(BUILD_DIRECTORY_PATH)/$@; \
     22  1.1  christos 	mkdir -p obj; \
     23  1.1  christos 	$(MAKE) || exit "$$?"; \
     24  1.1  christos 	if [ $(findstring 64,$(HARDWARE_NAME)) ]; then \
     25  1.1  christos 		echo "64-bit version of $@:"; \
     26  1.1  christos 	else \
     27  1.1  christos 		echo "32-bit version of $@:"; \
     28  1.1  christos 	fi; \
     29  1.1  christos 	ls -al ../bin/$@; \
     30  1.1  christos 	echo "";
     31  1.1  christos 
     32  1.1  christos #
     33  1.1  christos # Simple clean removes all .obj files, but leaves the executables
     34  1.1  christos # in the local bin directory
     35  1.1  christos #
     36  1.1  christos clean:	FORCE
     37  1.1  christos 	@for toolname in $(PROGS); do \
     38  1.1  christos 		(cd $(BUILD_DIRECTORY_PATH)/$$toolname; \
     39  1.1  christos 		if [ -d "obj" ] ; then \
     40  1.1  christos 			echo "Removing $$toolname:"; \
     41  1.1  christos 			pwd; \
     42  1.1  christos 			$(MAKE) clean; \
     43  1.1  christos 			rmdir obj; \
     44  1.1  christos 			echo ""; \
     45  1.1  christos 		fi; \
     46  1.1  christos 		); \
     47  1.1  christos 	done;
     48  1.1  christos 
     49  1.1  christos #
     50  1.1  christos # Very clean removes all executables and the local bin directory
     51  1.1  christos #
     52  1.1  christos veryclean:	FORCE
     53  1.1  christos 	@for toolname in $(PROGS); do \
     54  1.1  christos 		(cd $(BUILD_DIRECTORY_PATH)/$$toolname; \
     55  1.1  christos 		if [ -d "obj" ] ; then \
     56  1.1  christos 			echo "Removing $$toolname:"; \
     57  1.1  christos 			pwd; \
     58  1.1  christos 			$(MAKE) clean; \
     59  1.1  christos 			rmdir obj; \
     60  1.1  christos 			echo ""; \
     61  1.1  christos 		fi; \
     62  1.1  christos 		); \
     63  1.1  christos 		if [ -e "$(BUILD_DIRECTORY_PATH)/bin/$$toolname" ] ; then \
     64  1.1  christos 			rm $(BUILD_DIRECTORY_PATH)/bin/$$toolname; \
     65  1.1  christos 		fi; \
     66  1.1  christos 	done; \
     67  1.1  christos 	if [ -d "bin" ] ; then \
     68  1.1  christos 		rmdir bin; \
     69  1.1  christos 	fi;
     70  1.1  christos 
     71  1.1  christos #
     72  1.1  christos # Install all tools, either 32-bit or 64-bit as appropriate for the host OS
     73  1.1  christos #
     74  1.1  christos install:	FORCE
     75  1.1  christos 	@for toolname in $(PROGS); do \
     76  1.1  christos 		(cd $(BUILD_DIRECTORY_PATH)/$$toolname; \
     77  1.1  christos 		pwd; \
     78  1.1  christos 		$(MAKE) PROG=$$toolname install; \
     79  1.1  christos 		if [ $(findstring 64,$(HARDWARE_NAME)) ]; then \
     80  1.1  christos 			echo "Installed 64-bit version of $$toolname"; \
     81  1.1  christos 		else \
     82  1.1  christos 			echo "Installed 32-bit version of $$toolname"; \
     83  1.1  christos 		fi; \
     84  1.1  christos 		echo ""; \
     85  1.1  christos 		); \
     86  1.1  christos 	done;
     87  1.1  christos 
     88  1.1  christos machine:	FORCE
     89  1.1  christos 	@echo "Machine architecture: $(HARDWARE_NAME), $(XBITS)";
     90  1.1  christos 	@echo "Findstring: $(findstring 64, $(HARDWARE_NAME))";
     91  1.1  christos 
     92  1.1  christos FORCE:
     93  1.1  christos 
     94