#!/usr/bin/make KERNEL_DIR=/usr/src/linux ifdef APPSONLY CFLAGS?=-Wall -Wstrict-prototypes -Wno-trigraphs -O2 -s -I. -fno-strict-aliasing -fno-common -fomit-frame-pointer else include $(KERNEL_DIR)/.config include $(KERNEL_DIR)/conf.vars endif CKERNOPS:=-D__KERNEL__ -DMODULE -fno-builtin -nostdlib -DKBUILD_MODNAME="cloop" -DKBUILD_BASENAME="cloop" ifdef CONFIG_MODVERSIONS MODVERSIONS:= -DMODVERSIONS -include $(KERNEL_DIR)/include/linux/modversions.h CKERNOPS += $(MODVERSIONS) endif # Check for SMP in config and #define __SMP__ if necessary. # This is ESSENTIAL when compiling a SMP version of cloop.o # Otherwise, the module will block the entire block buffer management on read. ifdef CONFIG_SMP CKERNOPS += -D__SMP__ endif KERNOBJ:=compressed_loop.o # Name of module ifeq ($(PATCHLEVEL),"6") MODULE:=cloop.ko else MODULE:=cloop.o endif ALL_TARGETS = create_compressed_fs extract_compressed_fs ifndef APPSONLY ALL_TARGETS += $(MODULE) endif all: $(ALL_TARGETS) $(MODULE): compressed_loop.o $(LD) -r -o $@ $^ create_compressed_fs: create_compressed_fs.o $(CC) -o $@ $< -lz extract_compressed_fs: extract_compressed_fs.o $(CC) -o $@ $< -lz clean: rm -f cloop.o $(KERNOBJ) create_compressed_fs extract_compressed_fs zoom *.o dist: clean cd .. ; \ tar -cf - cloop/{Makefile,*.[ch],CHANGELOG,README} | \ bzip2 -9 > $(HOME)/redhat/SOURCES/cloop.tar.bz2 # There must be a better way to handle this $(KERNOBJ): %.o : %.c $(CC) -I$(KERNEL_DIR)/include -I$(KERNEL_DIR)/include/asm/mach-default $(CFLAGS) $(CKERNOPS) $< -c -o $@ compressed_loop.o create_compressed_fs.o: compressed_loop.h