summaryrefslogtreecommitdiff
path: root/lib/make/make.config.rules.in
blob: 07c37d9eff1853a2a03fedb409a0a113f87ddf28 (plain)
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
# /*@@
#   @file      make.config.rules.in
#   @date      Sun Jan 17 22:31:16 1999
#   @author    Tom Goodale
#   @desc 
#   Rules to generate object files from source files in another directory.
#
#   Note that, due to the (IMHO) rather bizarre way in which Make
#   deals with directories in the target names, this will
#   not work if the target is in a subdirectory.
#
#   @enddesc 
# @@*/

# Dividers to make the screen output slightly nicer
DIVEL   =  __________________
DIVIDER =  $(DIVEL)$(DIVEL)$(DIVEL)$(DIVEL)

define PREPROCESS_C
cat $< | $(PERL) $(CCTK_HOME)/lib/sbin/c_file_processor.pl $(CONFIG) > $(notdir $<)
endef

define COMPILE_C 
current_wd=`pwd` ; cd $(SCRATCH_BUILD) ; $(CC) $(CFLAGS) -c -o $$current_wd/$@ $$current_wd/$(notdir $<) $(INC_DIRS:%=-I%) $(EXTRA_DEFINES:%=-D%) -DCCODE
endef

define POSTPROCESS_C
endef

%.o: $(SRCDIR)/%.c
	@echo $(DIVIDER)
	@echo Preprocessing $<
	$(PREPROCESS_C)
	@echo Compiling $<
	$(COMPILE_C)
	@echo Postprocessing $<
	$(POSTPROCESS_C)

%.d: $(SRCDIR)/%.c
	$(CPP) -M $(CFLAGS) $< $(INC_DIRS:%=-I%) $(EXTRA_DEFINES:%=-D%) -DCCODE > $@

%.o: $(SRCDIR)/%.cc
	$(CXX) $(CXXFLAGS) -c -o $@ $< $(INC_DIRS:%=-I%) $(EXTRA_DEFINES:%=-D%) -DCCODE

%.d: $(SRCDIR)/%.cc
	$(CPP) -M $(CFLAGS) $< $(INC_DIRS:%=-I%) $(EXTRA_DEFINES:%=-D%) -DCCODE > $@

%.o: $(SRCDIR)/%.F77
	$(F77) $(F77FLAGS) -c -o $@ $< $(INC_DIRS:%=-I%) $(EXTRA_DEFINES:%=-D%) -DFCODE

%.d: $(SRCDIR)/%.F77
	$(CPP) -M $(F77FLAGS) $< $(INC_DIRS:%=-I%) $(EXTRA_DEFINES:%=-D%) -DFCODE > $@

%.o: $(SRCDIR)/%.F
	$(F90) $(F90FLAGS) -c -o $@ $< $(INC_DIRS:%=-I%) $(EXTRA_DEFINES:%=-D%) -DFCODE

%.d: $(SRCDIR)/%.F77
	$(CPP) -M $(F77FLAGS) $< $(INC_DIRS:%=-I%) $(EXTRA_DEFINES:%=-D%) -DFCODE > $@